Преглед на файлове

Merge branch 'master' into 39-dynamic-roles

* master: (189 commits)
  Remove test thread code
  Remove defunct tcl/pthread lines
  libelf: Fix trying to 'clean' on BSD where it is not used.
  BSDMakefile: Fix -j support with 'make'
  Use more proper top_builddir for objects
  Fix always relinking wraith when dependencies not change.
  Add newline.
  Update to bdlib 9ee3b7d84
  Fix help having empty/truncated entries since c8664e198
  Use the flag macros rather than ints for HUB, LEAF
  Fix garbled help broken since c8664e198
  Make libelf warnings quiet.
  Remove annoying blank line when building
  Only libstdc++ needs to be statically linked. This removes the need for -rpath as well.
  GCC: Link libstdc++ and libgcc statically
  Allow -q as root
  par can't be NULL
  Remove unused value.
  Remove unused value.
  Fix logic error resulting in NULL dereference. Not a possible case currently.
  ...
Bryan Drewery преди 11 години
родител
ревизия
f3ec2328d9
променени са 100 файла, в които са добавени 23925 реда и са изтрити 1112 реда
  1. 11 1
      .gitignore
  2. 25 2
      .travis.yml
  3. 19 16
      BSDmakefile
  4. 1 1
      LICENSE
  5. 26 109
      Makefile.in
  6. 1 1
      build.sh
  7. 41 27
      build/autotools/configure.ac
  8. 346 185
      build/autotools/depcomp
  9. 56 39
      build/autotools/includes/acinclude.m4
  10. 165 0
      build/autotools/includes/ax_cxx_compile_stdcxx_11.m4
  11. 17 12
      build/autotools/includes/depend.m4
  12. 31 0
      build/autotools/includes/libelf.m4
  13. 527 0
      build/autotools/install-sh
  14. 65 38
      build/build.mk
  15. 42 0
      build/makehelp.sh
  16. 36 0
      build/makeres.sh
  17. 18 0
      build/makeset.sh
  18. 487 469
      configure
  19. 33 0
      doc/UPDATES
  20. 0 2
      doc/help.txt
  21. 17 200
      doc/responses.txt
  22. 0 4
      doc/settings.txt
  23. 21 5
      lib/Makefile.in
  24. 1 1
      lib/bdlib
  25. 481 0
      lib/libelf/COPYING.LIB
  26. 1435 0
      lib/libelf/ChangeLog
  27. 176 0
      lib/libelf/INSTALL
  28. 96 0
      lib/libelf/MANIFEST
  29. 198 0
      lib/libelf/Makefile.in
  30. 332 0
      lib/libelf/README
  31. 1 0
      lib/libelf/VERSION
  32. 89 0
      lib/libelf/acconfig.h
  33. 336 0
      lib/libelf/aclocal.m4
  34. 1459 0
      lib/libelf/config.guess
  35. 151 0
      lib/libelf/config.h.in
  36. 1805 0
      lib/libelf/config.sub
  37. 7264 0
      lib/libelf/configure
  38. 379 0
      lib/libelf/configure.in
  39. 119 0
      lib/libelf/install-sh
  40. 155 0
      lib/libelf/lib/32.fsize.c
  41. 56 0
      lib/libelf/lib/32.getehdr.c
  42. 56 0
      lib/libelf/lib/32.getphdr.c
  43. 58 0
      lib/libelf/lib/32.getshdr.c
  44. 80 0
      lib/libelf/lib/32.newehdr.c
  45. 118 0
      lib/libelf/lib/32.newphdr.c
  46. 438 0
      lib/libelf/lib/32.xlatetof.c
  47. 512 0
      lib/libelf/lib/64.xlatetof.c
  48. 278 0
      lib/libelf/lib/Makefile.in
  49. 166 0
      lib/libelf/lib/Makefile.w32
  50. 33 0
      lib/libelf/lib/assert.c
  51. 429 0
      lib/libelf/lib/begin.c
  52. 36 0
      lib/libelf/lib/build.bat
  53. 95 0
      lib/libelf/lib/byteswap.h
  54. 178 0
      lib/libelf/lib/checksum.c
  55. 71 0
      lib/libelf/lib/cntl.c
  56. 161 0
      lib/libelf/lib/config.h.w32
  57. 501 0
      lib/libelf/lib/cook.c
  58. 36 0
      lib/libelf/lib/data.c
  59. 996 0
      lib/libelf/lib/elf_repl.h
  60. 118 0
      lib/libelf/lib/end.c
  61. 77 0
      lib/libelf/lib/errmsg.c
  62. 32 0
      lib/libelf/lib/errno.c
  63. 100 0
      lib/libelf/lib/errors.h
  64. 334 0
      lib/libelf/lib/ext_types.h
  65. 29 0
      lib/libelf/lib/fill.c
  66. 92 0
      lib/libelf/lib/flag.c
  67. 155 0
      lib/libelf/lib/gelf.h
  68. 140 0
      lib/libelf/lib/gelfehdr.c
  69. 148 0
      lib/libelf/lib/gelfphdr.c
  70. 125 0
      lib/libelf/lib/gelfshdr.c
  71. 407 0
      lib/libelf/lib/gelftrans.c
  72. 37 0
      lib/libelf/lib/getarhdr.c
  73. 40 0
      lib/libelf/lib/getaroff.c
  74. 87 0
      lib/libelf/lib/getarsym.c
  75. 33 0
      lib/libelf/lib/getbase.c
  76. 157 0
      lib/libelf/lib/getdata.c
  77. 48 0
      lib/libelf/lib/getident.c
  78. 48 0
      lib/libelf/lib/getscn.c
  79. 38 0
      lib/libelf/lib/hash.c
  80. 106 0
      lib/libelf/lib/input.c
  81. 33 0
      lib/libelf/lib/kind.c
  82. 82 0
      lib/libelf/lib/libelf.def
  83. 305 0
      lib/libelf/lib/libelf.h
  84. 1 0
      lib/libelf/lib/libelf/byteswap.h
  85. 1 0
      lib/libelf/lib/libelf/elf_repl.h
  86. 1 0
      lib/libelf/lib/libelf/errors.h
  87. 1 0
      lib/libelf/lib/libelf/ext_types.h
  88. 1 0
      lib/libelf/lib/libelf/gelf.h
  89. 1 0
      lib/libelf/lib/libelf/libelf.h
  90. 1 0
      lib/libelf/lib/libelf/nlist.h
  91. 1 0
      lib/libelf/lib/libelf/private.h
  92. 1 0
      lib/libelf/lib/libelf/sys_elf.h
  93. 1 0
      lib/libelf/lib/libelf/verdef.h
  94. 1 0
      lib/libelf/lib/libelf/verneed.h
  95. 53 0
      lib/libelf/lib/memset.c
  96. 33 0
      lib/libelf/lib/ndxscn.c
  97. 56 0
      lib/libelf/lib/newdata.c
  98. 145 0
      lib/libelf/lib/newscn.c
  99. 42 0
      lib/libelf/lib/next.c
  100. 54 0
      lib/libelf/lib/nextscn.c

+ 11 - 1
.gitignore

@@ -1,6 +1,7 @@
 /Makefile
 /build/confcache
 /build/config.cache
+/config.cache
 /build/confdefs.h
 /src/config.h
 /build/config.log
@@ -12,7 +13,6 @@
 /hub
 /leaf.*
 /hub.*
-/utctime
 /wraith
 /ts
 /...
@@ -25,3 +25,13 @@ cscope.in.out
 cscope.out
 cscope.po.out
 tags
+/lib/libelf/Makefile
+/lib/libelf/config.cache
+/lib/libelf/config.h
+/lib/libelf/config.status
+/lib/libelf/lib/Makefile
+/lib/libelf/lib/stamp-h
+/lib/libelf/lib/sys_elf.h
+/lib/libelf/po/Makefile
+/lib/libelf/stamp-h
+/lib/libelf/lib/*.os

+ 25 - 2
.travis.yml

@@ -5,10 +5,33 @@ compiler:
   - gcc
 
 before_install:
+  - if [ "$CXX" = "g++" ]; then sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y; fi
   - sudo apt-get update
-  - sudo apt-get install libcppunit-dev libcppunit-1.12-1 libssl-dev openssl tcl tcl-dev
+  - sudo apt-get install tcl tcl-dev
+  - if [ "$CXX" = "g++" ]; then sudo apt-get install libcppunit-dev libcppunit-1.12-1; fi
+  - if [ "$CXX" = "g++" ]; then sudo apt-get install gcc-4.8 g++-4.8; fi
+  - if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
+  - if [ "$CXX" = "clang++" ]; then sudo apt-get install clang-3.4; fi
+  - if [ "$CXX" = "clang++" ]; then svn co --quiet http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi; fi
+  - if [ "$CXX" = "clang++" ]; then svn co --quiet http://llvm.org/svn/llvm-project/libcxx/trunk libcxx; fi
+  - if [ "$CXX" = "clang++" ]; then (cd libcxx/lib && env CXX="clang++ -I ../../libcxxabi/include" sh buildit); fi
+  - if [ "$CXX" = "clang++" ]; then sudo cp libcxx/lib/libc++.so.1.0 /usr/lib/; fi
+  - if [ "$CXX" = "clang++" ]; then sudo mkdir /usr/include/c++/v1; fi
+  - if [ "$CXX" = "clang++" ]; then sudo cp -r libcxx/include/* /usr/include/c++/v1/; fi
+  - if [ "$CXX" = "clang++" ]; then sudo ln -sf libc++.so.1.0 /usr/lib/libc++.so; fi
+  - if [ "$CXX" = "clang++" ]; then sudo ln -sf libc++.so.1.0 /usr/lib/libc++.so.1; fi
+  - if [ "$CXX" = "clang++" ]; then (cd libcxxabi/lib && env CXX="clang++ -I ../../libcxx/include" sh buildit); fi
+  - if [ "$CXX" = "clang++" ]; then sudo cp libcxxabi/lib/libc++abi.so.1.0 /usr/lib/; fi
+  - if [ "$CXX" = "clang++" ]; then sudo ln -sf libc++abi.so.1.0 /usr/lib/libc++abi.so; fi
+  - if [ "$CXX" = "clang++" ]; then sudo ln -sf libc++abi.so.1.0 /usr/lib/libc++abi.so.1; fi
+  - if [ "$CXX" = "clang++" ]; then export CXXFLAGS="-stdlib=libc++" LDFLAGS="-stdlib=libc++ -lc++abi"; fi
+  - if [ "$CXX" = "clang++" ]; then (wget http://dev-www.libreoffice.org/src/cppunit-1.13.2.tar.gz && tar -zxvf cppunit-1.13.2.tar.gz && cd cppunit-1.13.2 && ./configure --prefix=/usr --disable-doc --disable-doxygen --disable-html-docs && make -j2 && sudo make install); fi
+  - export CPPFLAGS="-D_FORTIFY_SOURCE=2"
 
-script: ./configure && make debug && make test
+script:
+  - if [ "${COVERITY_SCAN_BRANCH}" != "1" ]; then ./configure; fi
+  - if [ "${COVERITY_SCAN_BRANCH}" != "1" ]; then make -j2 V=1; fi
+  - if [ "${COVERITY_SCAN_BRANCH}" != "1" ]; then make -j2 test V=1; fi
 
 # Skip install
 install: true

+ 19 - 16
BSDmakefile

@@ -1,18 +1,21 @@
-.PHONY: default check_gmake debug static dynamic clean distclean test
+#.PHONY: default check_gmake debug static dynamic clean distclean test
 
-default: check_gmake
-	@gmake
-check_gmake:
+MAKE=env -u MAKELEVEL gmake ${MFLAGS}
+
+TARGETS=	\
+		all \
+		debug \
+		static \
+		dynamic \
+		clean \
+		distclean \
+		test \
+		check
+
+.for target in ${TARGETS}
+${target}: check_gmake .PHONY .SILENT
+	@${MAKE} ${.TARGET}
+.endfor
+
+check_gmake: .PHONY .SILENT
 	@which gmake > /dev/null 2>&1 || (echo "Please install gmake" && exit 0)
-debug: check_gmake
-	@gmake debug
-static: check_gmake
-	@gmake static
-dynamic: check_gmake
-	@gmake dynamic
-clean: check_gmake
-	@gmake clean
-distclean: check_gmake
-	@gmake distclean
-test: check_gmake
-	@gmake test

+ 1 - 1
LICENSE

@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 1997 Robey Pointer
  * Copyright (C) 1999 - 2002 Eggheads Development Team (http://www.eggheads.org)
- * Copyright (C) 2002 - 2013 Bryan Drewery (http://wraith.botpack.net)
+ * Copyright (C) 2002 - 2014 Bryan Drewery (http://wraith.botpack.net)
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License

+ 26 - 109
Makefile.in

@@ -12,10 +12,10 @@ VPATH = @srcdir@
 CCDEPMODE = @CCDEPMODE@
 BINEXEC = wraith@EXEEXT@
 
-STATICMAKEFILES = lib/Makefile src/mod/Makefile src/crypto/Makefile src/compat/Makefile src/Makefile Makefile
+STATICMAKEFILES = lib/Makefile src/Makefile Makefile
 CONFIGFILES = build/config.cache build/config.log build/config.status src/config.h src/buildinfo.h
 
-DISTROFILES = README LICENSE build doc scripts lib Makefile.in build.sh configure src BSDmakefile
+DISTROFILES = README.md LICENSE build doc scripts lib Makefile.in build.sh configure src BSDmakefile
 EXCLUDES = $(CONFIGFILES) $(STATICMAKEFILES)
 
 COMMIT_FULL 	:= $(shell git log -1 --pretty=format:%H HEAD)
@@ -26,94 +26,71 @@ VERSION 	:= $(shell git describe)
 DISTRIB = wraith-$(VERSION)
 
 HELPFILE = doc/help.txt
-SETTINGSFILE = doc/settings.txt
-RESPONSESFILE = doc/responses.txt
 
 # defaults
-CXX = @CCACHE@ @DISTCC@ @CXX@ @STATIC@ -no-integrated-cpp
+CXX = @CXX@
+CC = @CC@
 LD_DYNAMIC = @CXX@
 LD_STATIC = @CXX@ @STATIC@
-CCDEBUG = @CCACHE@ @DISTCC@ @CXX@
 LD_DEBUG = @CXX@
 STRIP = @STRIP@
 DIFF = @DIFF@
 
 #LIBS = @LIBS@ @ZLIB@
 LIBS = @LIBS@
-INCLUDES = @TCL_INCLUDES@
-
-DEBCXXFLAGS = -DDEBUG -fno-inline -g3 -ggdb3 -O0 -Wshadow -Wpointer-arith -Wcast-align @GCC3DEB@ @GCC4DEB@ @DEBCXXFLAGS@
-CFLGS = @GCC3@ -fno-rtti @SSL_INCLUDES@
-_CFLGS = -fno-strict-aliasing -W -Wformat \
-#-Wshadow -Wnested-externs -Wno-format-y2k \
-#-Wlarger-than-6608 -Wpointer-arith -Wcast-align \
-#-Waggrepate-return -Wbad-function-cast \
-#-Wlong-long @GCC3@
-
-#-Wmissing-noreturn
-#-Wunused-parameter
-#-Wwrite-strings
-#-Wconversion
-#-Wtraditional
+INCLUDES = @TCL_INCLUDES@ @SSL_INCLUDES@
 
-MAKEFLAGS = -s
+DEBCXXFLAGS = -DDEBUG -fno-inline -g3 -ggdb3 -Wshadow -Wpointer-arith @GCC3DEB@ @GCC4DEB@ @DEBCXXFLAGS@
+CFLGS = @GCC3_CFLAGS@
+CXXFLAGS = @CXXFLAGS@ $(CFLGS) @GCC3_CXXFLAGS@ -fno-rtti
 
-STRINGFIX = src/stringfix
+MAKEFLAGS = -s
 
 MAKE_STATIC = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'LD=$(LD_STATIC)' 'INCLUDES=$(INCLUDES)' \
 'CCDEPMODE=$(CCDEPMODE)' 'BRANCH=$(BRANCH)' 'COMMIT=$(COMMIT_SHORT)' 'BUILDTS=$(BUILDTS)' 'VERSION=$(VERSION)' \
-'STRIP=$(STRIP)' 'CFLGS=$(CFLGS) -DBIN_TYPE_STATIC' 'STRINGFIX=$(STRINGFIX)' \
+'STRIP=$(STRIP)' 'CXXFLAGS=$(CXXFLAGS)' 'CFLGS=$(CFLGS) -DBIN_TYPE_STATIC' \
 'LIBS=$(LIBS)' 'EGGEXEC=$(BINEXEC)' 'EGGBUILD=(wraith)'
 
-MAKE_DYNAMIC = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'LD=$(LD_DYNAMIC)' 'INCLUDES=$(INCLUDES)' \
+MAKE_DYNAMIC = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'CC=$(CC)' 'LD=$(LD_DYNAMIC)' 'INCLUDES=$(INCLUDES)' \
 'CCDEPMODE=$(CCDEPMODE)' 'BRANCH=$(BRANCH)' 'COMMIT=$(COMMIT_SHORT)' 'BUILDTS=$(BUILDTS)' 'VERSION=$(VERSION)' \
-'STRIP=$(STRIP)' 'CFLGS=$(CFLGS) -DBIN_TYPE_DYNAMIC' 'STRINGFIX=$(STRINGFIX)' \
+'STRIP=$(STRIP)' 'CXXFLAGS=$(CXXFLAGS)' 'CFLGS=$(CFLGS) -DBIN_TYPE_DYNAMIC' \
 'LIBS=$(LIBS)' 'EGGEXEC=$(BINEXEC)' 'EGGBUILD=(wraith)'
 
-MAKE_DEBUG = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CCDEBUG)' 'LD=$(LD_DEBUG) -g' 'INCLUDES=$(INCLUDES)' \
+MAKE_DEBUG = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'CC=$(CC)' 'LD=$(LD_DEBUG) -g' 'INCLUDES=$(INCLUDES)' \
 'CCDEPMODE=$(CCDEPMODE)' 'BRANCH=$(BRANCH)' 'COMMIT=$(COMMIT_SHORT)' 'BUILDTS=$(BUILDTS)' 'VERSION=$(VERSION)' \
-'STRIP=touch' 'CFLGS=$(CFLGS) $(DEBCXXFLAGS) -DBIN_TYPE_DYNAMIC' 'STRINGFIX=' \
+'STRIP=touch' 'CXXFLAGS=$(CXXFLAGS) $(DEBCXXFLAGS)' 'CFLGS=$(CFLGS) $(DEBCXXFLAGS) -DBIN_TYPE_DYNAMIC' \
 'LIBS=$(LIBS)' 'EGGEXEC=$(BINEXEC)' 'EGGBUILD=(debug)'
 
-MAKE_UTILS = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CCDEBUG)' 'STRIP=touch' 'INCLUDES=$(INCLUDES)' \
-'CCDEPMODE=$(CCDEPMODE)' \
-'CFLGS=$(CFLGS) $(DEBCXXFLAGS)' 'LIBS=$(LIBS)' 'LD=$(LD_DEBUG) -g'
-
-MAKE_UTILS_NR = $(MAKE) 'CXX=$(CXX)' 'STRIP=touch' 'INCLUDES=$(INCLUDES)' \
+MAKE_UTILS = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'CC=$(CC)' 'STRIP=touch' 'INCLUDES=$(INCLUDES)' \
 'CCDEPMODE=$(CCDEPMODE)' \
-'CFLGS=$(CFLGS) $(DEBCXXFLAGS)' 'LIBS=$(LIBS)' 'LD=$(LD) -g'
+'CXXFLAGS=$(CXXFLAGS) $(DEBCXXFLAGS)' 'CFLGS=$(CFLGS) $(DEBCXXFLAGS)' 'LIBS=$(LIBS)' 'LD=$(LD_DEBUG) -g'
 
-MAKE_CONFIG = $(MAKE) 'MAKE=$(MAKE)'
-
-.PHONY: checkclean.static checkclean.dynamic checkclean.debug lib wraith dwraith lib.debug debug test general crypto utils sorthelp makehelp makeset makeres stringfix set res help sort indent tar distrib distclean clean cleanutils test all dynamic static tags
+.PHONY: checkclean.static checkclean.dynamic checkclean.debug lib wraith dwraith lib.debug debug test general sorthelp sort indent tar distrib distclean clean cleanutils test all dynamic static tags
 
 all: dynamic
 
 test:
 
 cleanutils:
-	@rm -f $(STRINGFIX) src/sorthelp@EXEEXT@ src/makehelp@EXEEXT@ src/makeres@EXEEXT@ src/makeset@EXEEXT@
+	@rm -f src/sorthelp@EXEEXT@
 
 clean:  cleanutils
 	+@cd src && $(MAKE) clean
-	+@cd src/compat && $(MAKE) clean
-	+@cd src/crypto && $(MAKE) clean
-	+@cd src/mod && $(MAKE) clean
 	-+@cd lib && $(MAKE) clean
 	@rm -f $(BINEXEC) build/stamp.* *~ src/*~ configure.temp .mangled stamp.*
-	@rm -f src/help.h src/response.h src/responses.h utctime@EXEEXT@ ts@EXEEXT@
+	@rm -f ts@EXEEXT@
 
 distclean: clean
 	@rm -rf *-$(VERSION)/ autom4te.cache/ autoscan.log configure.scan
 	@rm -rf src/.deps/ src/compat/.deps/ src/strucutres/.deps/ src/mod/*.mod/.deps/ src/crypto/.deps src/.defs/
 	-+@cd lib && $(MAKE) distclean
-	@rm -f $(STATICMAKEFILES) $(CONFIGFILES) config.h config.log config.status config.cache
+	@rm -f $(STATICMAKEFILES) $(CONFIGFILES) config.h config.log config.status
 
 
 distrib: clean
 	@rm -rf $(DISTRIB)/
 	-+@cd lib && $(MAKE) distclean
-	@mkdir $(DISTRIB) && cp -r $(DISTROFILES) $(DISTRIB)
+	@mkdir $(DISTRIB) && cp -R $(DISTROFILES) $(DISTRIB)
 	@rm -rf `find $(DISTRIB)/ \( -name '*~' -o -name '*#' -o -name '*.orig' -o -name '*.rej' -o -name '*.bak' -o -name '.gitignore' -o -name '.*.swp' \) -type f -print`
 	@rm -rf `find $(DISTRIB)/ \( -name '.git' -o -name '.deps' \) -type d -print`
 	@for s in $(EXCLUDES); do \
@@ -156,61 +133,10 @@ sort: sorthelp
 	@(src/sorthelp@EXEEXT@ $(HELPFILE) $(HELPFILE) || (cp -f help.txt~ $(HELPFILE); echo "Sort failed, restoring backup."))
 	@rm -f help.txt~
 
-help: makehelp
-	@src/makehelp@EXEEXT@ $(HELPFILE) src/help.h~
-	@(if [ ! -f src/help.h ]; then \
-	touch src/help.h; \
-	fi)
-	@(if test "x`$(DIFF) -qurN src/help.h~ src/help.h`" != "x"; then \
-	cp -f src/help.h~ src/help.h; \
-	fi)
-
-set: makeset
-	@src/makeset@EXEEXT@ $(SETTINGSFILE) src/set_default.h~
-	@(if [ ! -f src/set_default.h ]; then \
-	touch src/set_default.h; \
-	fi)
-	@(if test "x`$(DIFF) -qurN src/set_default.h~ src/set_default.h`" != "x"; then \
-	cp -f src/set_default.h~ src/set_default.h; \
-	fi)
-
-
-res: makeres
-	@src/makeres@EXEEXT@ $(RESPONSESFILE) src/ 1
-	@(if [ ! -f src/response.h ]; then \
-	touch src/response.h; \
-	fi)
-	@(if [ ! -f src/responses.h ]; then \
-	touch src/responses.h; \
-	fi)
-	@(if test "x`$(DIFF) -qurN src/response.h~ src/response.h`" != "x"; then \
-	cp -f src/response.h~ src/response.h; \
-	fi)
-	@(if test "x`$(DIFF) -qurN src/responses.h~ src/responses.h`" != "x"; then \
-	cp -f src/responses.h~ src/responses.h; \
-	fi)
-
-stringfix: src/stringfix.c src/config.h
-	+@cd src && ${MAKE_UTILS} stringfix
-
-makeres: src/makeres.c
-	+@cd src && ${MAKE_UTILS} makeres
-
-makeset: src/makeset.c
-	+@cd src && ${MAKE_UTILS} makeset
-
-makehelp: src/makehelp.c
-	+@cd src && ${MAKE_UTILS} makehelp
-
-sorthelp: src/sorthelp.c
+sorthelp: src/sorthelp.cc
 	+@cd src && ${MAKE_UTILS} sorthelp
 
-utils: stringfix makehelp
-
-crypto:
-	+@cd src/crypto && ${MAKE_UTILS} crypto
-
-general: help res set stringfix
+general:
 
 .NOTPARALLEL: checkclean.static checkclean.dynamic checkclean.debug
 
@@ -242,19 +168,13 @@ dynamic: checkclean.dynamic lib general
 	@echo ""
 	@echo "Making dynamic binary"
 	@echo ""
-	@echo ""
-	+@cd src/mod && $(MAKE_DYNAMIC) static
-	+@cd src && $(MAKE_DYNAMIC) $(BINEXEC)
-	@echo ""
+	+@cd src && $(MAKE_DYNAMIC) ../$(BINEXEC)
 
 static: checkclean.static lib general
 	@echo ""
 	@echo "Making static binary"
 	@echo ""
-	@echo ""
-	+@cd src/mod && $(MAKE_STATIC) static
-	+@cd src && $(MAKE_STATIC) $(BINEXEC)
-	@echo ""
+	+@cd src && $(MAKE_STATIC) ../$(BINEXEC)
 
 dwraith: debug
 
@@ -265,10 +185,7 @@ debug: checkclean.debug lib.debug general
 	@echo ""
 	@echo "Making debug binary"
 	@echo ""
-	@echo ""
-	+@cd src/mod && $(MAKE_DEBUG) static
-	+@cd src && $(MAKE_DEBUG) $(BINEXEC)
-	@echo ""
+	+@cd src && $(MAKE_DEBUG) ../$(BINEXEC)
 
 #safety hash
 

+ 1 - 1
build.sh

@@ -12,7 +12,7 @@ fi
 
 # Convert timestamp into readable format
 rm -f ts > /dev/null 2>&1
-gcc -o ts src/timestamp.c > /dev/null 2>&1
+cc -o ts src/timestamp.c > /dev/null 2>&1
 builddate=`./ts ${BUILDTS}`
 rm -f ts > /dev/null 2>&1
 

+ 41 - 27
build/autotools/configure.ac

@@ -6,6 +6,7 @@ AC_PREREQ(2.59)
 AC_INIT([wraith],[],[wraith@botpack.net])
 AC_CONFIG_SRCDIR(src/eggdrop.h)
 AC_CONFIG_HEADER(src/config.h)
+AC_CONFIG_AUX_DIR([build/autotools])
 AC_COPYRIGHT([Copyright (c) Bryan Drewery])
 AC_REVISION($Revision$)
 
@@ -14,15 +15,14 @@ EGG_SAVE_PARAMETERS
 # Setup build environment
 dnl Search for newer gcc versions before older
 #AC_REQUIRE_CPP
-AC_LANG(C++)
-AC_PROG_CXX([g++49 g++-4.9 g++48 g++-4.8 g++47 g++-4.7 g++46 g++-4.6 g++45 g++-4.5 g++-4.4 g++-4.4.1 g++-4.4.2 g++-4.4.0 g++44 g++4 eg++ g++-3.3 g++33 g++-3 g++3 g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC])
-dnl AC_PROG_CC([gcc34 gcc-3.4 gcc33 gcc3 gcc-3.3 gcc cc c1])
+AC_LANG([C++])
+AC_PROG_CXX([g++49 g++-4.9 g++48 g++-4.8 g++47 g++-4.7 clang++ g++46 g++-4.6 g++45 g++-4.5 g++-4.4 g++-4.4.1 g++-4.4.2 g++-4.4.0 g++44 g++4 eg++ g++-3.3 g++33 g++-3 g++3 g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC])
+CC="${CXX} -x c"
+AC_SUBST(CC)
+AC_REQUIRE_CPP
+AX_CXX_COMPILE_STDCXX_11([noext], [mandatory])
 EGG_CHECK_CC
-
-# Crazy machines
-AC_AIX
-AC_ISC_POSIX
-AC_MINIX
+#CXX_RPATH_CHECK
 
 #checkpoint
 AC_CACHE_SAVE 
@@ -31,8 +31,22 @@ AC_CACHE_SAVE
 EGG_CHECK_CCWALL
 EGG_CHECK_CCPIPE
 CXX_FLAG_CHECK([CXXFLAGS], [-fcolor-diagnostics], [colordiagnostics])
-CXX_FLAG_CHECK([CXXFLAGS], [-Qunused-arguments], [unusedarguments])
-CXX_FLAG_CHECK([DEBCXXFLAGS], [-fstack-protector-all], [stackprotector])
+#CXX_FLAG_CHECK([CXXFLAGS], [-Qunused-arguments], [unusedarguments])
+CXX_FLAG_CHECK([CXXFLAGS], [-Wno-invalid-source-encoding], [invalid_source_encoding])
+CXX_FLAG_CHECK([CXXFLAGS], [-fstack-protector], [stackprotector])
+CXX_FLAG_CHECK([CXXFLAGS], [-fstack-protector-strong], [stackprotectorstrong])
+if [[ "${ax_cv_prog_cc_stackprotectorstrong}" = "yes" ]]; then
+  LDFLAGS="${LDFLAGS} -fstack-protector-strong"
+elif [[ "${ax_cv_prog_cc_stackprotector}" = "yes" ]]; then
+  LDFLAGS="${LDFLAGS} -fstack-protector"
+fi
+CXX_FLAG_CHECK([DEBCXXFLAGS], [-Og], [Og])
+if [[ "${ax_cv_prog_cc_Og}" = "no" ]]; then
+  DEBCXXFLAGS="${DEBCXXFLAGS} -O0"
+fi
+CXX_FLAG_CHECK([DEBCXXFLAGS], [-fstack-protector-all], [stackprotectorall])
+CXX_FLAG_CHECK([LDFLAGS], [-static-libstdc++], [static_libstdcxx])
+#CXX_FLAG_CHECK([LDFLAGS], [-static-libgcc], [static_libgcc])
 
 EGG_CHECK_DEPMODE
 
@@ -49,8 +63,6 @@ AC_CHECK_PROG(OBJCOPY, objcopy, [objcopy --remove-section=.note --remove-section
 AC_CHECK_PROG(STRIP, strip, strip, touch)
 AC_CHECK_PROG(DIFF, gdiff, gdiff, diff)
 AC_CHECK_PROG(UNAME, uname, uname)
-AC_CHECK_PROG(CCACHE, ccache, ccache)
-AC_CHECK_PROG(DISTCC, distcc, distcc)
 
 # Test the os and set the module linking settings
 EGG_CHECK_OS
@@ -65,7 +77,6 @@ EGG_CHECK_RANDOM_MAX
 
 # Create static binaries
 EGG_CHECK_CCSTATIC
-AC_SUBST(CCDEBUG)dnl
 AC_SUBST(DEBCXXFLAGS)
 
 #checkpoint
@@ -73,6 +84,7 @@ AC_CACHE_SAVE
 
 # Checks for system libraries
 EGG_CHECK_LIBS
+CHECK_LIBELF
 
 # Checks for header files
 AC_HEADER_DIRENT
@@ -199,8 +211,8 @@ AC_FUNC_STRFTIME
 
 #checkpoint
 AC_CACHE_SAVE
-AC_CHECK_FUNCS([clock fsync getrusage isascii getpassphrase])
-AC_CHECK_FUNCS([memcpy memset random rename snprintf srandom gettime])
+AC_CHECK_FUNCS([clock fsync getrusage isascii getpassphrase posix_madvise madvise])
+AC_CHECK_FUNCS([memcpy memmem memset random rename snprintf srandom gettime])
 #checkpoint
 AC_CACHE_SAVE
 AC_CHECK_FUNCS([strcasecmp strncasecmp vsnprintf inet_ntop])
@@ -221,11 +233,9 @@ AC_CACHE_SAVE
 
 EGG_SUBST_VERSION
 #FIND_WRAPS
-EGG_SUBST_MOD_UPDIR
 DO_DEPS
 
-AC_CONFIG_FILES([Makefile lib/Makefile src/Makefile src/compat/Makefile src/crypto/Makefile src/mod/Makefile src/buildinfo.h])
-AC_OUTPUT
+AC_CONFIG_FILES([Makefile lib/Makefile src/Makefile src/buildinfo.h])
 
 AH_TEMPLATE(HAVE_ST_MTIM, [Define to 1 if your struct stat has an st_mtim member])
 AH_TEMPLATE(HAVE_ST_MTIMESPEC, [Define to 1 if your struct stat has an st_mtimespec member])
@@ -253,17 +263,21 @@ fi
 if test -d .git; then
   git submodule init
   git submodule update
+  git submodule foreach --recursive git clean -fdx
+  # Restore as it may have been removed by an older 'make distclean'
+  if ! test -f src/response.h; then
+    git checkout src/response.h
+  fi
 fi
 ]
 
-CXX="$CXX" TCL_INCLUDES="$TCL_INCLUDES" SSL_INCLUDES="$SSL_INCLUDES" SED="$SED" src/generate_defs.sh
-[
-if [ $? -ne 0 ]; then
-  exit 1
+if [[ -f lib/bdlib/configure ]]; then
+  AC_CONFIG_SUBDIRS([lib/bdlib])
 fi
-]
+if [[ -n "${LIBELF_BUNDLED}" ]] && [[ -f lib/libelf/configure ]]; then
+  AC_CONFIG_SUBDIRS([lib/libelf])
+fi
+AC_OUTPUT
 
-echo ""
-echo ""
-echo "------------ Configuring BDLIB ------------"
-test -f lib/bdlib/configure && cd lib/bdlib && CXX="$CXX" ./configure
+CXX="$CXX" CXXFLAGS="$CXXFLAGS" TCL_INCLUDES="$TCL_INCLUDES" SSL_INCLUDES="$SSL_INCLUDES" \
+  SED="$SED" src/generate_defs.sh || exit 1

+ 346 - 185
build/autotools/depcomp

@@ -1,10 +1,9 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2013-05-30.07; # UTC
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
-# Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -28,9 +27,9 @@ scriptversion=2009-04-28.21; # UTC
 
 case $1 in
   '')
-     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
-     exit 1;
-     ;;
+    echo "$0: No command.  Try '$0 --help' for more information." 1>&2
+    exit 1;
+    ;;
   -h | --h*)
     cat <<\EOF
 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
@@ -40,11 +39,11 @@ as side-effects.
 
 Environment variables:
   depmode     Dependency tracking mode.
-  source      Source file read by `PROGRAMS ARGS'.
-  object      Object file output by `PROGRAMS ARGS'.
+  source      Source file read by 'PROGRAMS ARGS'.
+  object      Object file output by 'PROGRAMS ARGS'.
   DEPDIR      directory where to store dependencies.
   depfile     Dependency file to output.
-  tmpdepfile  Temporary file to use when outputing dependencies.
+  tmpdepfile  Temporary file to use when outputting dependencies.
   libtool     Whether libtool is used (yes/no).
 
 Report bugs to <bug-automake@gnu.org>.
@@ -57,6 +56,66 @@ EOF
     ;;
 esac
 
+# Get the directory component of the given path, and save it in the
+# global variables '$dir'.  Note that this directory component will
+# be either empty or ending with a '/' character.  This is deliberate.
+set_dir_from ()
+{
+  case $1 in
+    */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
+      *) dir=;;
+  esac
+}
+
+# Get the suffix-stripped basename of the given path, and save it the
+# global variable '$base'.
+set_base_from ()
+{
+  base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
+}
+
+# If no dependency file was actually created by the compiler invocation,
+# we still have to create a dummy depfile, to avoid errors with the
+# Makefile "include basename.Plo" scheme.
+make_dummy_depfile ()
+{
+  echo "#dummy" > "$depfile"
+}
+
+# Factor out some common post-processing of the generated depfile.
+# Requires the auxiliary global variable '$tmpdepfile' to be set.
+aix_post_process_depfile ()
+{
+  # If the compiler actually managed to produce a dependency file,
+  # post-process it.
+  if test -f "$tmpdepfile"; then
+    # Each line is of the form 'foo.o: dependency.h'.
+    # Do two passes, one to just change these to
+    #   $object: dependency.h
+    # and one to simply output
+    #   dependency.h:
+    # which is needed to avoid the deleted-header problem.
+    { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
+      sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
+    } > "$depfile"
+    rm -f "$tmpdepfile"
+  else
+    make_dummy_depfile
+  fi
+}
+
+# A tabulation character.
+tab='	'
+# A newline character.
+nl='
+'
+# Character ranges might be problematic outside the C locale.
+# These definitions help.
+upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
+lower=abcdefghijklmnopqrstuvwxyz
+digits=0123456789
+alpha=${upper}${lower}
+
 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
   echo "depcomp: Variables source, object and depmode must be set" 1>&2
   exit 1
@@ -69,6 +128,9 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
 
 rm -f "$tmpdepfile"
 
+# Avoid interferences from the environment.
+gccflag= dashmflag=
+
 # Some modes work just like other modes, but use different flags.  We
 # parameterize here, but still list the modes in the big case below,
 # to make depend.m4 easier to write.  Note that we *cannot* use a case
@@ -80,18 +142,32 @@ if test "$depmode" = hp; then
 fi
 
 if test "$depmode" = dashXmstdout; then
-   # This is just like dashmstdout with a different argument.
-   dashmflag=-xM
-   depmode=dashmstdout
+  # This is just like dashmstdout with a different argument.
+  dashmflag=-xM
+  depmode=dashmstdout
 fi
 
 cygpath_u="cygpath -u -f -"
 if test "$depmode" = msvcmsys; then
-   # This is just like msvisualcpp but w/o cygpath translation.
-   # Just convert the backslash-escaped backslashes to single forward
-   # slashes to satisfy depend.m4
-   cygpath_u="sed s,\\\\\\\\,/,g"
-   depmode=msvisualcpp
+  # This is just like msvisualcpp but w/o cygpath translation.
+  # Just convert the backslash-escaped backslashes to single forward
+  # slashes to satisfy depend.m4
+  cygpath_u='sed s,\\\\,/,g'
+  depmode=msvisualcpp
+fi
+
+if test "$depmode" = msvc7msys; then
+  # This is just like msvc7 but w/o cygpath translation.
+  # Just convert the backslash-escaped backslashes to single forward
+  # slashes to satisfy depend.m4
+  cygpath_u='sed s,\\\\,/,g'
+  depmode=msvc7
+fi
+
+if test "$depmode" = xlc; then
+  # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
+  gccflag=-qmakedep=gcc,-MF
+  depmode=gcc
 fi
 
 case "$depmode" in
@@ -114,8 +190,7 @@ gcc3)
   done
   "$@"
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     exit $stat
   fi
@@ -123,13 +198,17 @@ gcc3)
   ;;
 
 gcc)
+## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
+## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
+## (see the conditional assignment to $gccflag above).
 ## There are various ways to get dependency output from gcc.  Here's
 ## why we pick this rather obscure method:
 ## - Don't want to use -MD because we'd like the dependencies to end
 ##   up in a subdir.  Having to rename by hand is ugly.
 ##   (We might end up doing this anyway to support other compilers.)
 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
-##   -MM, not -M (despite what the docs say).
+##   -MM, not -M (despite what the docs say).  Also, it might not be
+##   supported by the other compilers which use the 'gcc' depmode.
 ## - Using -M directly means running the compiler twice (even worse
 ##   than renaming).
   if test -z "$gccflag"; then
@@ -137,31 +216,31 @@ gcc)
   fi
   "$@" -Wp,"$gccflag$tmpdepfile"
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     exit $stat
   fi
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
-  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
-## The second -e expression handles DOS-style file names with drive letters.
+  # The second -e expression handles DOS-style file names with drive
+  # letters.
   sed -e 's/^[^:]*: / /' \
       -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
-## This next piece of magic avoids the `deleted header file' problem.
+## This next piece of magic avoids the "deleted header file" problem.
 ## The problem is that when a header file which appears in a .P file
 ## is deleted, the dependency causes make to die (because there is
 ## typically no way to rebuild the header).  We avoid this by adding
 ## dummy dependencies for each header file.  Too bad gcc doesn't do
 ## this for us directly.
-  tr ' ' '
-' < "$tmpdepfile" |
-## Some versions of gcc put a space before the `:'.  On the theory
+## Some versions of gcc put a space before the ':'.  On the theory
 ## that the space means something, we add a space to the output as
-## well.
+## well.  hp depmode also adds that space, but also prefixes the VPATH
+## to the object.  Take care to not repeat it in the output.
 ## Some versions of the HPUX 10.20 sed can't process this invocation
 ## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  tr ' ' "$nl" < "$tmpdepfile" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
@@ -179,8 +258,7 @@ sgi)
     "$@" -MDupdate "$tmpdepfile"
   fi
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     exit $stat
   fi
@@ -188,43 +266,41 @@ sgi)
 
   if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
     echo "$object : \\" > "$depfile"
-
     # Clip off the initial element (the dependent).  Don't try to be
     # clever and replace this with sed code, as IRIX sed won't handle
     # lines with more than a fixed number of characters (4096 in
     # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
-    # the IRIX cc adds comments like `#:fec' to the end of the
+    # the IRIX cc adds comments like '#:fec' to the end of the
     # dependency line.
-    tr ' ' '
-' < "$tmpdepfile" \
-    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
-    tr '
-' ' ' >> "$depfile"
+    tr ' ' "$nl" < "$tmpdepfile" \
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
+      | tr "$nl" ' ' >> "$depfile"
     echo >> "$depfile"
-
     # The second pass generates a dummy entry for each header file.
-    tr ' ' '
-' < "$tmpdepfile" \
-   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
-   >> "$depfile"
+    tr ' ' "$nl" < "$tmpdepfile" \
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+      >> "$depfile"
   else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
+    make_dummy_depfile
   fi
   rm -f "$tmpdepfile"
   ;;
 
+xlc)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
 aix)
   # The C for AIX Compiler uses -M and outputs the dependencies
   # in a .u file.  In older versions, this file always lives in the
-  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # current directory.  Also, the AIX compiler puts '$object:' at the
   # start of each line; $object doesn't have directory information.
   # Version 6 uses the directory in both cases.
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-  test "x$dir" = "x$object" && dir=
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  set_dir_from "$object"
+  set_base_from "$object"
   if test "$libtool" = yes; then
     tmpdepfile1=$dir$base.u
     tmpdepfile2=$base.u
@@ -237,9 +313,7 @@ aix)
     "$@" -M
   fi
   stat=$?
-
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
     exit $stat
   fi
@@ -248,44 +322,100 @@ aix)
   do
     test -f "$tmpdepfile" && break
   done
-  if test -f "$tmpdepfile"; then
-    # Each line is of the form `foo.o: dependent.h'.
-    # Do two passes, one to just change these to
-    # `$object: dependent.h' and one to simply `dependent.h:'.
-    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-    # That's a tab and a space in the [].
-    sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
-  else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
+  aix_post_process_depfile
+  ;;
+
+tcc)
+  # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
+  # FIXME: That version still under development at the moment of writing.
+  #        Make that this statement remains true also for stable, released
+  #        versions.
+  # It will wrap lines (doesn't matter whether long or short) with a
+  # trailing '\', as in:
+  #
+  #   foo.o : \
+  #    foo.c \
+  #    foo.h \
+  #
+  # It will put a trailing '\' even on the last line, and will use leading
+  # spaces rather than leading tabs (at least since its commit 0394caf7
+  # "Emit spaces for -MD").
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
   fi
+  rm -f "$depfile"
+  # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
+  # We have to change lines of the first kind to '$object: \'.
+  sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
+  # And for each line of the second kind, we have to emit a 'dep.h:'
+  # dummy dependency, to avoid the deleted-header problem.
+  sed -n -e 's|^  *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
-icc)
-  # Intel's C compiler understands `-MD -MF file'.  However on
-  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
-  # ICC 7.0 will fill foo.d with something like
-  #    foo.o: sub/foo.c
-  #    foo.o: sub/foo.h
-  # which is wrong.  We want:
-  #    sub/foo.o: sub/foo.c
-  #    sub/foo.o: sub/foo.h
-  #    sub/foo.c:
-  #    sub/foo.h:
-  # ICC 7.1 will output
+## The order of this option in the case statement is important, since the
+## shell code in configure will try each of these formats in the order
+## listed in this file.  A plain '-MD' option would be understood by many
+## compilers, so we must ensure this comes after the gcc and icc options.
+pgcc)
+  # Portland's C compiler understands '-MD'.
+  # Will always output deps to 'file.d' where file is the root name of the
+  # source file under compilation, even if file resides in a subdirectory.
+  # The object file name does not affect the name of the '.d' file.
+  # pgcc 10.2 will output
   #    foo.o: sub/foo.c sub/foo.h
-  # and will wrap long lines using \ :
+  # and will wrap long lines using '\' :
   #    foo.o: sub/foo.c ... \
   #     sub/foo.h ... \
   #     ...
+  set_dir_from "$object"
+  # Use the source, not the object, to determine the base name, since
+  # that's sadly what pgcc will do too.
+  set_base_from "$source"
+  tmpdepfile=$base.d
+
+  # For projects that build the same source file twice into different object
+  # files, the pgcc approach of using the *source* file root name can cause
+  # problems in parallel builds.  Use a locking strategy to avoid stomping on
+  # the same $tmpdepfile.
+  lockdir=$base.d-lock
+  trap "
+    echo '$0: caught signal, cleaning up...' >&2
+    rmdir '$lockdir'
+    exit 1
+  " 1 2 13 15
+  numtries=100
+  i=$numtries
+  while test $i -gt 0; do
+    # mkdir is a portable test-and-set.
+    if mkdir "$lockdir" 2>/dev/null; then
+      # This process acquired the lock.
+      "$@" -MD
+      stat=$?
+      # Release the lock.
+      rmdir "$lockdir"
+      break
+    else
+      # If the lock is being held by a different process, wait
+      # until the winning process is done or we timeout.
+      while test -d "$lockdir" && test $i -gt 0; do
+        sleep 1
+        i=`expr $i - 1`
+      done
+    fi
+    i=`expr $i - 1`
+  done
+  trap - 1 2 13 15
+  if test $i -le 0; then
+    echo "$0: failed to acquire lock after $numtries attempts" >&2
+    echo "$0: check lockdir '$lockdir'" >&2
+    exit 1
+  fi
 
-  "$@" -MD -MF "$tmpdepfile"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     exit $stat
   fi
@@ -297,8 +427,8 @@ icc)
   sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
   # Some versions of the HPUX 10.20 sed can't process this invocation
   # correctly.  Breaking it into two sed invocations is a workaround.
-  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
-    sed -e 's/$/ :/' >> "$depfile"
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
@@ -309,9 +439,8 @@ hp2)
   # 'foo.d', which lands next to the object file, wherever that
   # happens to be.
   # Much of this is similar to the tru64 case; see comments there.
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-  test "x$dir" = "x$object" && dir=
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  set_dir_from  "$object"
+  set_base_from "$object"
   if test "$libtool" = yes; then
     tmpdepfile1=$dir$base.d
     tmpdepfile2=$dir.libs/$base.d
@@ -322,8 +451,7 @@ hp2)
     "$@" +Maked
   fi
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
      rm -f "$tmpdepfile1" "$tmpdepfile2"
      exit $stat
   fi
@@ -333,77 +461,107 @@ hp2)
     test -f "$tmpdepfile" && break
   done
   if test -f "$tmpdepfile"; then
-    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
-    # Add `dependent.h:' lines.
+    sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
+    # Add 'dependent.h:' lines.
     sed -ne '2,${
-	       s/^ *//
-	       s/ \\*$//
-	       s/$/:/
-	       p
-	     }' "$tmpdepfile" >> "$depfile"
+               s/^ *//
+               s/ \\*$//
+               s/$/:/
+               p
+             }' "$tmpdepfile" >> "$depfile"
   else
-    echo "#dummy" > "$depfile"
+    make_dummy_depfile
   fi
   rm -f "$tmpdepfile" "$tmpdepfile2"
   ;;
 
 tru64)
-   # The Tru64 compiler uses -MD to generate dependencies as a side
-   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
-   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
-   # dependencies in `foo.d' instead, so we check for that too.
-   # Subdirectories are respected.
-   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-   test "x$dir" = "x$object" && dir=
-   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-
-   if test "$libtool" = yes; then
-      # With Tru64 cc, shared objects can also be used to make a
-      # static library.  This mechanism is used in libtool 1.4 series to
-      # handle both shared and static libraries in a single compilation.
-      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
-      #
-      # With libtool 1.5 this exception was removed, and libtool now
-      # generates 2 separate objects for the 2 libraries.  These two
-      # compilations output dependencies in $dir.libs/$base.o.d and
-      # in $dir$base.o.d.  We have to check for both files, because
-      # one of the two compilations can be disabled.  We should prefer
-      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
-      # automatically cleaned when .libs/ is deleted, while ignoring
-      # the former would cause a distcleancheck panic.
-      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
-      tmpdepfile2=$dir$base.o.d          # libtool 1.5
-      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
-      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
-      "$@" -Wc,-MD
-   else
-      tmpdepfile1=$dir$base.o.d
-      tmpdepfile2=$dir$base.d
-      tmpdepfile3=$dir$base.d
-      tmpdepfile4=$dir$base.d
-      "$@" -MD
-   fi
-
-   stat=$?
-   if test $stat -eq 0; then :
-   else
-      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
-      exit $stat
-   fi
-
-   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
-   do
-     test -f "$tmpdepfile" && break
-   done
-   if test -f "$tmpdepfile"; then
-      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-      # That's a tab and a space in the [].
-      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
-   else
-      echo "#dummy" > "$depfile"
-   fi
-   rm -f "$tmpdepfile"
-   ;;
+  # The Tru64 compiler uses -MD to generate dependencies as a side
+  # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
+  # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+  # dependencies in 'foo.d' instead, so we check for that too.
+  # Subdirectories are respected.
+  set_dir_from  "$object"
+  set_base_from "$object"
+
+  if test "$libtool" = yes; then
+    # Libtool generates 2 separate objects for the 2 libraries.  These
+    # two compilations output dependencies in $dir.libs/$base.o.d and
+    # in $dir$base.o.d.  We have to check for both files, because
+    # one of the two compilations can be disabled.  We should prefer
+    # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+    # automatically cleaned when .libs/ is deleted, while ignoring
+    # the former would cause a distcleancheck panic.
+    tmpdepfile1=$dir$base.o.d          # libtool 1.5
+    tmpdepfile2=$dir.libs/$base.o.d    # Likewise.
+    tmpdepfile3=$dir.libs/$base.d      # Compaq CCC V6.2-504
+    "$@" -Wc,-MD
+  else
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir$base.d
+    tmpdepfile3=$dir$base.d
+    "$@" -MD
+  fi
+
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+    exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  # Same post-processing that is required for AIX mode.
+  aix_post_process_depfile
+  ;;
+
+msvc7)
+  if test "$libtool" = yes; then
+    showIncludes=-Wc,-showIncludes
+  else
+    showIncludes=-showIncludes
+  fi
+  "$@" $showIncludes > "$tmpdepfile"
+  stat=$?
+  grep -v '^Note: including file: ' "$tmpdepfile"
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  # The first sed program below extracts the file names and escapes
+  # backslashes for cygpath.  The second sed program outputs the file
+  # name when reading, but also accumulates all include files in the
+  # hold buffer in order to output them again at the end.  This only
+  # works with sed implementations that can handle large buffers.
+  sed < "$tmpdepfile" -n '
+/^Note: including file:  *\(.*\)/ {
+  s//\1/
+  s/\\/\\\\/g
+  p
+}' | $cygpath_u | sort -u | sed -n '
+s/ /\\ /g
+s/\(.*\)/'"$tab"'\1 \\/p
+s/.\(.*\) \\/\1:/
+H
+$ {
+  s/.*/'"$tab"'/
+  G
+  p
+}' >> "$depfile"
+  echo >> "$depfile" # make sure the fragment doesn't end with a backslash
+  rm -f "$tmpdepfile"
+  ;;
+
+msvc7msys)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
 
 #nosideeffect)
   # This comment above is used by automake to tell side-effect
@@ -422,7 +580,7 @@ dashmstdout)
     shift
   fi
 
-  # Remove `-o $object'.
+  # Remove '-o $object'.
   IFS=" "
   for arg
   do
@@ -442,18 +600,18 @@ dashmstdout)
   done
 
   test -z "$dashmflag" && dashmflag=-M
-  # Require at least two characters before searching for `:'
+  # Require at least two characters before searching for ':'
   # in the target name.  This is to cope with DOS-style filenames:
-  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
   "$@" $dashmflag |
-    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+    sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
   rm -f "$depfile"
   cat < "$tmpdepfile" > "$depfile"
-  tr ' ' '
-' < "$tmpdepfile" | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this sed invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  tr ' ' "$nl" < "$tmpdepfile" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
@@ -503,12 +661,15 @@ makedepend)
   touch "$tmpdepfile"
   ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
   rm -f "$depfile"
-  cat < "$tmpdepfile" > "$depfile"
-  sed '1,2d' "$tmpdepfile" | tr ' ' '
-' | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  # makedepend may prepend the VPATH from the source file name to the object.
+  # No need to regex-escape $object, excess matching of '.' is harmless.
+  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process the last invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed '1,2d' "$tmpdepfile" \
+    | tr ' ' "$nl" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile" "$tmpdepfile".bak
   ;;
 
@@ -525,7 +686,7 @@ cpp)
     shift
   fi
 
-  # Remove `-o $object'.
+  # Remove '-o $object'.
   IFS=" "
   for arg
   do
@@ -544,10 +705,10 @@ cpp)
     esac
   done
 
-  "$@" -E |
-    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
-    sed '$ s: \\$::' > "$tmpdepfile"
+  "$@" -E \
+    | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+             -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+    | sed '$ s: \\$::' > "$tmpdepfile"
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
   cat < "$tmpdepfile" >> "$depfile"
@@ -579,23 +740,23 @@ msvisualcpp)
       shift
       ;;
     "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
-	set fnord "$@"
-	shift
-	shift
-	;;
+        set fnord "$@"
+        shift
+        shift
+        ;;
     *)
-	set fnord "$@" "$arg"
-	shift
-	shift
-	;;
+        set fnord "$@" "$arg"
+        shift
+        shift
+        ;;
     esac
   done
   "$@" -E 2>/dev/null |
   sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
-  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
-  echo "	" >> "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
+  echo "$tab" >> "$depfile"
   sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;

+ 56 - 39
build/autotools/includes/acinclude.m4

@@ -185,19 +185,19 @@ dnl @synopsis CXX_FLAGS_CHECK [var] [compiler flags] [cache name] [required]
 dnl @summary check whether compiler supports given C++ flags or not
 AC_DEFUN([CXX_FLAG_CHECK],
 [
-  AC_CACHE_CHECK([whether the compiler understands $2], egg_cv_prog_cc_$3, [
+  AC_CACHE_CHECK([whether the compiler understands $2], ax_cv_prog_cc_$3, [
     AC_LANG_PUSH([C++])
     ac_saved_flags="$CXXFLAGS"
     CXXFLAGS="-Werror $2"
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
-      [egg_cv_prog_cc_$3="yes"],
-      [egg_cv_prog_cc_$3="no"],
+      [ax_cv_prog_cc_$3="yes"],
+      [ax_cv_prog_cc_$3="no"],
     )
     CXXFLAGS="$ac_saved_flags"
     AC_LANG_POP([C++])
   ])
 
-  if [[ "$egg_cv_prog_cc_$3" = "yes" ]]; then
+  if [[ "$ax_cv_prog_cc_$3" = "yes" ]]; then
     $1="$$1 $2"
   elif [[ -n "$4" ]]; then
       cat << 'EOF' >&2
@@ -211,6 +211,57 @@ EOF
   fi
 ])
 
+dnl Fix GCC lame compiler paths (FreeBSD)
+dnl @summary check whether compiler requires -rpath for libstdc++.so
+AC_DEFUN([CXX_RPATH_CHECK],
+[
+  AC_CACHE_CHECK([whether the compiler requires -rpath], ax_cv_prog_cc_need_rpath, [
+  AC_TRY_RUN([
+#include <vector>
+int main() {
+        std::vector<int> test;
+        try {
+                return test.at(5);
+        } catch (...) {
+                ;
+        }
+        return 0;
+}
+  ], ax_cv_prog_cc_need_rpath=no, ax_cv_prog_cc_need_rpath=yes)])
+
+  if [[ "${ax_cv_prog_cc_need_rpath}" = "yes" ]]; then
+    save_ldflags="$LDFLAGS"
+    AC_CACHE_CHECK([whether the compiler requires -rpath], ax_cv_prog_cc_rpath, [
+      ax_cv_prog_cc_rpath=
+
+      for path in `${CXX} -print-search-dirs | awk '/^libraries:/ {print substr([$]0, 13)}' | tr ':' ' '`; do
+        if [[ -r "${path}/libstdc++.so" ]]; then
+          LDFLAGS="-Wl,-rpath,${path}"
+          AC_TRY_RUN([
+#include <vector>
+int main() {
+        std::vector<int> test;
+        try {
+                return test.at(5);
+        } catch (...) {
+                ;
+        }
+        return 0;
+}
+          ], ax_cv_prog_cc_rpath="`realpath ${path}`")
+          LDFLAGS="$save_ldflags"
+          [[ -n "${ax_cv_prog_cc_rpath}" ]] && break
+        fi
+      done
+    ])
+    LDFLAGS="$save_ldflags"
+  fi
+
+  if [[ -n "${ax_cv_prog_cc_rpath}" ]]; then
+    LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-Wl,-rpath,${ax_cv_prog_cc_rpath}"
+  fi
+])
+
 dnl  EGG_CHECK_CCSTATIC()
 dnl
 dnl  Checks whether the compiler supports the `-static' flag.
@@ -439,20 +490,6 @@ AC_DEFUN([EGG_CHECK_LIBS],
   AC_CHECK_LIB(dl, dlopen)
 
 #  AC_CHECK_LIB(z, gzopen, ZLIB="-lz")
-  # This is needed for Tcl libraries compiled with thread support
-#  AC_CHECK_LIB(pthread, pthread_mutex_init, [dnl
-#  ac_cv_lib_pthread_pthread_mutex_init=yes
-#  ac_cv_lib_pthread="-lpthread"], [dnl
-#    AC_CHECK_LIB(pthread, __pthread_mutex_init, [dnl
-#    ac_cv_lib_pthread_pthread_mutex_init=yes
-#    ac_cv_lib_pthread="-lpthread"], [dnl
-#      AC_CHECK_LIB(pthreads, pthread_mutex_init, [dnl
-#      ac_cv_lib_pthread_pthread_mutex_init=yes
-#      ac_cv_lib_pthread="-lpthreads"], [dnl
-#        AC_CHECK_FUNC(pthread_mutex_init, [dnl
-#        ac_cv_lib_pthread_pthread_mutex_init=yes
-#        ac_cv_lib_pthread=""],
-#        ac_cv_lib_pthread_pthread_mutex_init=no)])])])
   if test "$SUNOS" = "yes"; then
     # For suns without yp
     AC_CHECK_LIB(dl, main)
@@ -651,7 +688,7 @@ dnl  EGG_SUBST_VERSION()
 dnl
 AC_DEFUN([EGG_SUBST_VERSION], 
 [
-VERSION=`grep "char" $srcdir/src/main.c | $AWK '/egg_version/ {print [$]5}' | sed -e 's/\"//g' | sed -e 's/\;//g'`
+VERSION=`grep "char" $srcdir/src/main.cc | $AWK '/egg_version/ {print [$]5}' | sed -e 's/\"//g' | sed -e 's/\;//g'`
 version_num=`echo $VERSION | $AWK 'BEGIN {FS = "."} {printf("%d%02d%02d", [$]1, [$]2, [$]3)}'`
 AC_DEFINE_UNQUOTED(EGG_VERSION, $version_num, [Defines the current pack version])dnl
 AC_SUBST(VERSION)dnl
@@ -659,26 +696,6 @@ AC_SUBST(NUMVER)dnl
 ])
 
 
-dnl  EGG_SUBST_MOD_UPDIR()
-dnl
-dnl  Since module's Makefiles aren't generated by configure, some
-dnl  paths in src/mod/Makefile.in take care of them. For correct
-dnl  path "calculation", we need to keep absolute paths in mind
-dnl  (which don't need a "../" pre-pended).
-AC_DEFUN([EGG_SUBST_MOD_UPDIR],
-[
-case "$srcdir" in
-  [[\\/]]* | ?:[[\\/]]*)
-    MOD_UPDIR=""
-  ;;
-  *)
-    MOD_UPDIR="../"
-  ;;
-esac
-AC_SUBST(MOD_UPDIR)dnl
-])dnl
-
-
 dnl EGG_REPLACE_IF_CHANGED(FILE-NAME, CONTENTS-CMDS, INIT-CMDS)
 dnl
 dnl Replace FILE-NAME if the newly created contents differs from the existing

+ 165 - 0
build/autotools/includes/ax_cxx_compile_stdcxx_11.m4

@@ -0,0 +1,165 @@
+# ============================================================================
+#  http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
+# ============================================================================
+#
+# SYNOPSIS
+#
+#   AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional])
+#
+# DESCRIPTION
+#
+#   Check for baseline language coverage in the compiler for the C++11
+#   standard; if necessary, add switches to CXXFLAGS to enable support.
+#
+#   The first argument, if specified, indicates whether you insist on an
+#   extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
+#   -std=c++11).  If neither is specified, you get whatever works, with
+#   preference for an extended mode.
+#
+#   The second argument, if specified 'mandatory' or if left unspecified,
+#   indicates that baseline C++11 support is required and that the macro
+#   should error out if no mode with that support is found.  If specified
+#   'optional', then configuration proceeds regardless, after defining
+#   HAVE_CXX11 if and only if a supporting mode is found.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
+#   Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
+#   Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
+#   Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 10
+
+m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[
+  template <typename T>
+    struct check
+    {
+      static_assert(sizeof(int) <= sizeof(T), "not big enough");
+    };
+
+    struct Base {
+    virtual void f() {}
+    };
+    struct Child : public Base {
+    virtual void f() override {}
+    };
+
+    typedef check<check<bool>> right_angle_brackets;
+
+    int a;
+    decltype(a) b;
+
+    typedef check<int> check_type;
+    check_type c;
+    check_type&& cr = static_cast<check_type&&>(c);
+
+    auto d = a;
+    auto l = [](){};
+    // Prevent Clang error: unused variable 'l' [-Werror,-Wunused-variable]
+    struct use_l { use_l() { l(); } };
+
+    // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
+    // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function because of this
+    namespace test_template_alias_sfinae {
+        struct foo {};
+
+        template<typename T>
+        using member = typename T::member_type;
+
+        template<typename T>
+        void func(...) {}
+
+        template<typename T>
+        void func(member<T>*) {}
+
+        void test();
+
+        void test() {
+            func<foo>(0);
+        }
+    }
+]])
+
+AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
+  m4_if([$1], [], [],
+        [$1], [ext], [],
+        [$1], [noext], [],
+        [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
+  m4_if([$2], [], [ax_cxx_compile_cxx11_required=true],
+        [$2], [mandatory], [ax_cxx_compile_cxx11_required=true],
+        [$2], [optional], [ax_cxx_compile_cxx11_required=false],
+        [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])
+  AC_LANG_PUSH([C++])dnl
+  ac_success=no
+  AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
+  ax_cv_cxx_compile_cxx11,
+  [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
+    [ax_cv_cxx_compile_cxx11=yes],
+    [ax_cv_cxx_compile_cxx11=no])])
+  if test x$ax_cv_cxx_compile_cxx11 = xyes; then
+    ac_success=yes
+  fi
+
+  m4_if([$1], [noext], [], [dnl
+  if test x$ac_success = xno; then
+    for switch in -std=gnu++11 -std=gnu++0x; do
+      cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
+      AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
+                     $cachevar,
+        [ac_save_CXXFLAGS="$CXXFLAGS"
+         CXXFLAGS="$CXXFLAGS $switch"
+         AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
+          [eval $cachevar=yes],
+          [eval $cachevar=no])
+         CXXFLAGS="$ac_save_CXXFLAGS"])
+      if eval test x\$$cachevar = xyes; then
+        CXXFLAGS="$CXXFLAGS $switch"
+        ac_success=yes
+        break
+      fi
+    done
+  fi])
+
+  m4_if([$1], [ext], [], [dnl
+  if test x$ac_success = xno; then
+    for switch in -std=c++11 -std=c++0x; do
+      cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
+      AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
+                     $cachevar,
+        [ac_save_CXXFLAGS="$CXXFLAGS"
+         CXXFLAGS="$CXXFLAGS $switch"
+         AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
+          [eval $cachevar=yes],
+          [eval $cachevar=no])
+         CXXFLAGS="$ac_save_CXXFLAGS"])
+      if eval test x\$$cachevar = xyes; then
+        CXXFLAGS="$CXXFLAGS $switch"
+        ac_success=yes
+        break
+      fi
+    done
+  fi])
+  AC_LANG_POP([C++])
+  if test x$ax_cxx_compile_cxx11_required = xtrue; then
+    if test x$ac_success = xno; then
+      AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
+    fi
+  else
+    if test x$ac_success = xno; then
+      HAVE_CXX11=0
+      AC_MSG_NOTICE([No compiler with C++11 support was found])
+    else
+      HAVE_CXX11=1
+      AC_DEFINE(HAVE_CXX11,1,
+                [define if the compiler supports basic C++11 syntax])
+    fi
+
+    AC_SUBST(HAVE_CXX11)
+  fi
+])

+ 17 - 12
build/autotools/includes/depend.m4

@@ -11,27 +11,26 @@ num=`$CXX -dumpversion | sed "s/^\\\(.\\\).*/\\\1/"`
 if test $num -ge "3"; then
   CCDEPMODE=gcc3
 #  GCC3="-Wpadded -Wpacked -Wno-unused-parameter -Wmissing-format-attribute -Wdisabled-optimization"
-  GCC3="-W -Wno-unused-parameter -Wdisabled-optimization -Wno-write-strings -Wno-format-security -fno-strict-aliasing -Woverloaded-virtual -Wno-format-y2k"
+  GCC3_CFLAGS="-W -Wno-unused-parameter -Wdisabled-optimization -Wno-write-strings -Wno-format-security -fno-strict-aliasing -Wno-format-y2k"
+  GCC3_CXXFLAGS="-Woverloaded-virtual"
   GCC3DEB="-Wno-disabled-optimization -Wmissing-format-attribute"
 fi
 AC_SUBST(CCDEPMODE)dnl
-AC_SUBST(GCC3)dnl
+AC_SUBST(GCC3_CFLAGS)dnl
+AC_SUBST(GCC3_CXXFLAGS)dnl
 AC_SUBST(GCC3DEB)dnl
 AC_SUBST(GCC4DEB)dnl
 ])
 
 AC_DEFUN([DO_DEPS],
 [
-files="src/Makefile.in src/compat/Makefile.in src/crypto/Makefile.in src/mod/channels.mod/Makefile src/mod/compress.mod/Makefile src/mod/console.mod/Makefile src/mod/ctcp.mod/Makefile src/mod/irc.mod/Makefile src/mod/server.mod/Makefile src/mod/share.mod/Makefile src/mod/transfer.mod/Makefile src/mod/update.mod/Makefile"
+files="src/Makefile.in"
 for mf in $files; do
   # Strip MF so we end up with the name of the file.
-#  echo "MF: $mf"
-  mf=`echo "$mf" | sed -e 's/:.*$//'`
-  dirpart=`AS_DIRNAME("$mf")`
-#  echo "dirpart: $dirpart mf: $mf"
-#  rm -rf "$dirpart/.deps/"
-  rm -f "$dirpart/.deps/includes"
-  test -d "$dirpart/.deps" || mkdir "$dirpart/.deps"
+  mf=${mf%%:*}
+  dirmf=${mf%/*}
+  rm -f "$dirmf/.deps/includes"
+  test -d "$dirmf/.deps" || mkdir "$dirmf/.deps"
   for file in `sed -n -e '
     /^OBJS = .*\\\\$/ {
       s/^OBJS = //
@@ -44,9 +43,15 @@ for mf in $files; do
     }
     /^OBJS = / s/^OBJS = //p' < "$mf"`;
   do
+    dirpart="${dirmf}/${file}"
+    dirpart="${dirpart%/*}"
+    if [[ "${dirpart}" != "${dirmf}" ]]; then
+      test -d "${dirpart}/.deps" || mkdir "${dirpart}/.deps"
+    fi
+    file="${file##*/}"
     suffix=${file##*.}
     base=${file%%.*}
-    test -f "$dirpart/$base.c" || continue
+    test -f "$dirpart/$base.cc" || test -f "$dirpart/$base.c" || continue
     if ! test -f "$dirpart/.deps/$base.Po"; then
       echo '# dummy' > "$dirpart/.deps/$base.Po"
       #Remove the .o file, because it needs to be recompiled for its dependancies.
@@ -54,7 +59,7 @@ for mf in $files; do
         rm -f "$dirpart/${base}.${suffix}"
       fi
     fi
-    echo "include .deps/$base.Po" >> "$dirpart/.deps/includes"
+    echo "include .${dirpart#${dirmf}}/.deps/$base.Po" >> "${dirmf}/.deps/includes"
   done
 done
 ])

+ 31 - 0
build/autotools/includes/libelf.m4

@@ -0,0 +1,31 @@
+AC_DEFUN([CHECK_LIBELF],
+[
+  LIBELF_DIR="lib/libelf/lib"
+  LIBELF_LIB="\$(top_builddir)/${LIBELF_DIR}/libelf.a"
+  LIBELF_BUNDLED="${LIBELF_LIB}"
+  LIBELF_INCLUDE="-I\$(top_srcdir)/${LIBELF_DIR}"
+
+  AC_CHECK_HEADERS([gelf.h libelf.h], [
+    AC_CHECK_TYPES([Elf_Note], [
+      AC_DEFINE(HAVE_GELF_H, 1, [Define to 1 if you have the <gelf.h> header file.])
+      AC_CHECK_LIB(elf, gelf_getehdr, [
+        AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the 'elf' library (-lelf).])
+        LIBELF_LIB="-Wl,-Bstatic -lelf -Wl,-Bdynamic"
+        LIBELF_BUNDLED=
+        LIBELF_INCLUDE=
+      ]) dnl AC_CHECK_LIB
+    ], dnl AC_CHECK_TYPES
+    [],
+    AC_LANG_SOURCE(
+      [[
+#include "gelf.h"
+#include "libelf.h"
+      ]])
+    )
+  ])
+
+  CPPFLAGS="${CPPFLAGS} ${LIBELF_INCLUDE}"
+
+  AC_SUBST([LIBELF_BUNDLED])
+  AC_SUBST([LIBELF_LIB])
+])

+ 527 - 0
build/autotools/install-sh

@@ -0,0 +1,527 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2011-11-20.07; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# 'make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" ""	$nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+  doit_exec=exec
+else
+  doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+  test "$posix_glob" != "?" || {
+    if (set -f) 2>/dev/null; then
+      posix_glob=
+    else
+      posix_glob=:
+    fi
+  }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+     --help     display this help and exit.
+     --version  display version info and exit.
+
+  -c            (ignored)
+  -C            install only if different (preserve the last data modification time)
+  -d            create directories instead of installing files.
+  -g GROUP      $chgrpprog installed files to GROUP.
+  -m MODE       $chmodprog installed files to MODE.
+  -o USER       $chownprog installed files to USER.
+  -s            $stripprog installed files.
+  -t DIRECTORY  install into DIRECTORY.
+  -T            report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+  RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+  case $1 in
+    -c) ;;
+
+    -C) copy_on_change=true;;
+
+    -d) dir_arg=true;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+	shift;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) mode=$2
+	case $mode in
+	  *' '* | *'	'* | *'
+'*	  | *'*'* | *'?'* | *'['*)
+	    echo "$0: invalid mode: $mode" >&2
+	    exit 1;;
+	esac
+	shift;;
+
+    -o) chowncmd="$chownprog $2"
+	shift;;
+
+    -s) stripcmd=$stripprog;;
+
+    -t) dst_arg=$2
+	# Protect names problematic for 'test' and other utilities.
+	case $dst_arg in
+	  -* | [=\(\)!]) dst_arg=./$dst_arg;;
+	esac
+	shift;;
+
+    -T) no_target_directory=true;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    --)	shift
+	break;;
+
+    -*)	echo "$0: invalid option: $1" >&2
+	exit 1;;
+
+    *)  break;;
+  esac
+  shift
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+  # When -d is used, all remaining arguments are directories to create.
+  # When -t is used, the destination is already specified.
+  # Otherwise, the last argument is the destination.  Remove it from $@.
+  for arg
+  do
+    if test -n "$dst_arg"; then
+      # $@ is not empty: it contains at least $arg.
+      set fnord "$@" "$dst_arg"
+      shift # fnord
+    fi
+    shift # arg
+    dst_arg=$arg
+    # Protect names problematic for 'test' and other utilities.
+    case $dst_arg in
+      -* | [=\(\)!]) dst_arg=./$dst_arg;;
+    esac
+  done
+fi
+
+if test $# -eq 0; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call 'install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+if test -z "$dir_arg"; then
+  do_exit='(exit $ret); exit $ret'
+  trap "ret=129; $do_exit" 1
+  trap "ret=130; $do_exit" 2
+  trap "ret=141; $do_exit" 13
+  trap "ret=143; $do_exit" 15
+
+  # Set umask so as not to create temps with too-generous modes.
+  # However, 'strip' requires both read and write access to temps.
+  case $mode in
+    # Optimize common cases.
+    *644) cp_umask=133;;
+    *755) cp_umask=22;;
+
+    *[0-7])
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw='% 200'
+      fi
+      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+    *)
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw=,u+rw
+      fi
+      cp_umask=$mode$u_plus_rw;;
+  esac
+fi
+
+for src
+do
+  # Protect names problematic for 'test' and other utilities.
+  case $src in
+    -* | [=\(\)!]) src=./$src;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    dstdir=$dst
+    test -d "$dstdir"
+    dstdir_status=$?
+  else
+
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dst_arg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+    dst=$dst_arg
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+	echo "$0: $dst_arg: Is a directory" >&2
+	exit 1
+      fi
+      dstdir=$dst
+      dst=$dstdir/`basename "$src"`
+      dstdir_status=0
+    else
+      # Prefer dirname, but fall back on a substitute if dirname fails.
+      dstdir=`
+	(dirname "$dst") 2>/dev/null ||
+	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	     X"$dst" : 'X\(//\)[^/]' \| \
+	     X"$dst" : 'X\(//\)$' \| \
+	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+	echo X"$dst" |
+	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)[^/].*/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\).*/{
+		   s//\1/
+		   q
+		 }
+		 s/.*/./; q'
+      `
+
+      test -d "$dstdir"
+      dstdir_status=$?
+    fi
+  fi
+
+  obsolete_mkdir_used=false
+
+  if test $dstdir_status != 0; then
+    case $posix_mkdir in
+      '')
+	# Create intermediate dirs using mode 755 as modified by the umask.
+	# This is like FreeBSD 'install' as of 1997-10-28.
+	umask=`umask`
+	case $stripcmd.$umask in
+	  # Optimize common cases.
+	  *[2367][2367]) mkdir_umask=$umask;;
+	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+	  *[0-7])
+	    mkdir_umask=`expr $umask + 22 \
+	      - $umask % 100 % 40 + $umask % 20 \
+	      - $umask % 10 % 4 + $umask % 2
+	    `;;
+	  *) mkdir_umask=$umask,go-w;;
+	esac
+
+	# With -d, create the new directory with the user-specified mode.
+	# Otherwise, rely on $mkdir_umask.
+	if test -n "$dir_arg"; then
+	  mkdir_mode=-m$mode
+	else
+	  mkdir_mode=
+	fi
+
+	posix_mkdir=false
+	case $umask in
+	  *[123567][0-7][0-7])
+	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
+	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+	    ;;
+	  *)
+	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+	    if (umask $mkdir_umask &&
+		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+	    then
+	      if test -z "$dir_arg" || {
+		   # Check for POSIX incompatibilities with -m.
+		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+		   # other-writable bit of parent directory when it shouldn't.
+		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
+		   case $ls_ld_tmpdir in
+		     d????-?r-*) different_mode=700;;
+		     d????-?--*) different_mode=755;;
+		     *) false;;
+		   esac &&
+		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+		   }
+		 }
+	      then posix_mkdir=:
+	      fi
+	      rmdir "$tmpdir/d" "$tmpdir"
+	    else
+	      # Remove any dirs left behind by ancient mkdir implementations.
+	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+	    fi
+	    trap '' 0;;
+	esac;;
+    esac
+
+    if
+      $posix_mkdir && (
+	umask $mkdir_umask &&
+	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+      )
+    then :
+    else
+
+      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # or it failed possibly due to a race condition.  Create the
+      # directory the slow way, step by step, checking for races as we go.
+
+      case $dstdir in
+	/*) prefix='/';;
+	[-=\(\)!]*) prefix='./';;
+	*)  prefix='';;
+      esac
+
+      eval "$initialize_posix_glob"
+
+      oIFS=$IFS
+      IFS=/
+      $posix_glob set -f
+      set fnord $dstdir
+      shift
+      $posix_glob set +f
+      IFS=$oIFS
+
+      prefixes=
+
+      for d
+      do
+	test X"$d" = X && continue
+
+	prefix=$prefix$d
+	if test -d "$prefix"; then
+	  prefixes=
+	else
+	  if $posix_mkdir; then
+	    (umask=$mkdir_umask &&
+	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+	    # Don't fail if two instances are running concurrently.
+	    test -d "$prefix" || exit 1
+	  else
+	    case $prefix in
+	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+	      *) qprefix=$prefix;;
+	    esac
+	    prefixes="$prefixes '$qprefix'"
+	  fi
+	fi
+	prefix=$prefix/
+      done
+
+      if test -n "$prefixes"; then
+	# Don't fail if two instances are running concurrently.
+	(umask $mkdir_umask &&
+	 eval "\$doit_exec \$mkdirprog $prefixes") ||
+	  test -d "$dstdir" || exit 1
+	obsolete_mkdir_used=true
+      fi
+    fi
+  fi
+
+  if test -n "$dir_arg"; then
+    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+  else
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+    # Copy the file name to the temp name.
+    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+    # If -C, don't bother to copy if it wouldn't change the file.
+    if $copy_on_change &&
+       old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
+       new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&
+
+       eval "$initialize_posix_glob" &&
+       $posix_glob set -f &&
+       set X $old && old=:$2:$4:$5:$6 &&
+       set X $new && new=:$2:$4:$5:$6 &&
+       $posix_glob set +f &&
+
+       test "$old" = "$new" &&
+       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+    then
+      rm -f "$dsttmp"
+    else
+      # Rename the file to the real destination.
+      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+      # The rename failed, perhaps because mv can't rename something else
+      # to itself, or perhaps because mv is so ancient that it does not
+      # support -f.
+      {
+	# Now remove or move aside any old file at destination location.
+	# We try this two ways since rm can't unlink itself on some
+	# systems and the destination file might be busy for other
+	# reasons.  In this case, the final cleanup might fail but the new
+	# file should still install successfully.
+	{
+	  test ! -f "$dst" ||
+	  $doit $rmcmd -f "$dst" 2>/dev/null ||
+	  { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+	    { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+	  } ||
+	  { echo "$0: cannot unlink or rename $dst" >&2
+	    (exit 1); exit 1
+	  }
+	} &&
+
+	# Now rename the file to the real destination.
+	$doit $mvcmd "$dsttmp" "$dst"
+      }
+    fi || exit 1
+
+    trap '' 0
+  fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:

+ 65 - 38
build/build.mk

@@ -1,70 +1,97 @@
 depcomp = /bin/sh $(top_srcdir)/build/autotools/depcomp
 
-.SUFFIXES:
-.SUFFIXES: .c .cc .h .o .So
+STRINGFIX= $(srcdir)/stringfix
 
-.cc.So:
-	@echo -e "{CC}	\033[1m$*\033[0m"
-	set -e; trap "rm -f '.deps/$*.TPo' $*.ii; exit 1" 1 2 3 5 10 13 15; \
+$(STRINGFIX): $(STRINGFIX).cc
+	@echo -e "[CXX]	\033[1m$@\033[0m"
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $< $(LDFLAGS) -o $(STRINGFIX)
+
+# Cannot use .SUFFIXES as it won't allow a dependency on $(STRINGFIX)
+
+%.So: %.cc $(STRINGFIX)
+	@echo -e "{CXX}	\033[1m$<\033[0m"
+	file="$*"; \
+	dirname="$${file%/*}"; \
+	if [ "$${dirname}" = "$${file}" ]; then dirname=.; fi; \
+	file="$${file##*/}"; \
+	deps="$${dirname}/.deps/$${file}"; \
+	set -e; trap "rm -f "$${deps}.TPo" $*.ii $*.fail; exit 1" 1 2 3 5 10 13 15; \
 	if [ "$(CCDEPMODE)" = "gcc3" ]; then \
-	  if $(CXX) -MT '$@' -MD -MP -MF '.deps/$*.TPo' $(CXXFLAGS) $(CPPFLAGS) -E $< | $(top_srcdir)/src/stringfix > $*.ii; then \
-	    echo '$@: $(top_srcdir)/src/stringfix' >> '.deps/$*.TPo'; \
-	    mv '.deps/$*.TPo' '.deps/$*.Po'; \
+	  if { { $(CXX) -MT '$@' -MD -MP -MF "$${deps}.TPo" $(CXXFLAGS) $(CPPFLAGS) -E $< || :> $*.fail; } | \
+	    $(STRINGFIX) > $*.ii; } && ! [ -f $*.fail ]; then \
+	    echo '$@: $(STRINGFIX)' >> "$${deps}.TPo"; \
+	    mv "$${deps}.TPo" "$${deps}.Po"; \
 	   else \
-	     rm -f '.deps/$*.TPo' $*.ii; \
+	     rm -f "$${deps}.TPo" $*.ii $*.fail; \
 	     exit 1; \
 	  fi; \
 	else \
-	  libtool=no source='$<' object='$@' depfile='.deps/$*.Po' tmpdepfile='.deps/$*.TPo' depmode=$(CCDEPMODE) $(depcomp) \
-	  $(CXX) $(CXXFLAGS) $(CPPFLAGS) -E $< | $(top_srcdir)/src/stringfix > $*.ii; \
+	  libtool=no source='$<' object='$@' depfile="$${deps}.Po" tmpdepfile="$${deps}.TPo" depmode=$(CCDEPMODE) $(depcomp) \
+	  $(CXX) $(CPPFLAGS) $(CXXFLAGS) -E $< | $(STRINGFIX) > $*.ii; \
 	fi; \
-	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $*.ii -o $@; \
+	$(CXX) $(CXXFLAGS) -c $*.ii -o $@; \
 	rm -f $*.ii
 
-.c.So:
-	@echo -e "{C }	\033[1m$*\033[0m"
-	set -e; trap "rm -f '.deps/$*.TPo' $*.i; exit 1" 1 2 3 5 10 13 15; \
+%.So: %.c $(STRINGFIX)
+	@echo -e "{CC }	\033[1m$<\033[0m"
+	file="$*"; \
+	dirname="$${file%/*}"; \
+	if [ "$${dirname}" = "$${file}" ]; then dirname=.; fi; \
+	file="$${file##*/}"; \
+	deps="$${dirname}/.deps/$${file}"; \
+	set -e; trap "rm -f "$${deps}.TPo" $*.i $*.fail; exit 1" 1 2 3 5 10 13 15; \
 	if [ "$(CCDEPMODE)" = "gcc3" ]; then \
-	  if $(CXX) -MT '$@' -MD -MP -MF '.deps/$*.TPo' $(CXXFLAGS) $(CPPFLAGS) -E $< | $(top_srcdir)/src/stringfix > $*.i; then \
-	    echo '$@: $(top_srcdir)/src/stringfix' >> '.deps/$*.TPo'; \
-	    mv '.deps/$*.TPo' '.deps/$*.Po'; \
+	  if { { $(CC) -MT '$@' -MD -MP -MF "$${deps}.TPo" $(CPPFLAGS) $(CFLAGS) -E $< || :> $*.fail; } | \
+	    $(STRINGFIX) > $*.i; } && ! [ -f $*.fail ]; then \
+	    echo '$@: $(STRINGFIX)' >> "$${deps}.TPo"; \
+	    mv "$${deps}.TPo" "$${deps}.Po"; \
 	   else \
-	     rm -f '.deps/$*.TPo' $*.i; \
+	     rm -f "$${deps}.TPo" $*.i $*.fail; \
 	     exit 1; \
 	  fi; \
 	else \
-	  libtool=no source='$<' object='$@' depfile='.deps/$*.Po' tmpdepfile='.deps/$*.TPo' depmode=$(CCDEPMODE) $(depcomp) \
-	  $(CXX) $(CXXFLAGS) $(CPPFLAGS) -E $< | $(top_srcdir)/src/stringfix > $*.i; \
+	  libtool=no source='$<' object='$@' depfile="$${deps}.Po" tmpdepfile="$${deps}.TPo" depmode=$(CCDEPMODE) $(depcomp) \
+	  $(CC) $(CPPFLAGS) $(CFLAGS) -E $< | $(STRINGFIX) > $*.i; \
 	fi; \
-	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $*.i -o $@; \
+	$(CC) $(CFLAGS) -c $*.i -o $@; \
 	rm -f $*.i
 
-.cc.o:
-	@echo -e "[CC]	\033[1m$*\033[0m"
-	set -e; trap "rm -f '.deps/$*.TPo'; exit 1" 1 2 3 5 10 13 15; \
+%.o: %.cc
+	@echo -e "[CXX]	\033[1m$<\033[0m"
+	file="$*"; \
+	dirname="$${file%/*}"; \
+	if [ "$${dirname}" = "$${file}" ]; then dirname=.; fi; \
+	file="$${file##*/}"; \
+	deps="$${dirname}/.deps/$${file}"; \
+	set -e; trap "rm -f "$${deps}.TPo"; exit 1" 1 2 3 5 10 13 15; \
 	if [ "$(CCDEPMODE)" = "gcc3" ]; then \
-	  if $(CXX) -MT '$@' -MD -MP -MF '.deps/$*.TPo' $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@; then \
-	    mv '.deps/$*.TPo' '.deps/$*.Po'; \
+	  if $(CXX) -MT '$@' -MD -MP -MF "$${deps}.TPo" $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@; then \
+	    mv "$${deps}.TPo" "$${deps}.Po"; \
 	   else \
-	     rm -f '.deps/$*.TPo'; \
+	     rm -f "$${deps}.TPo"; \
 	     exit 1; \
 	  fi; \
 	else \
-	  libtool=no source='$<' object='$@' depfile='.deps/$*.Po' tmpdepfile='.deps/$*.TPo' depmode=$(CCDEPMODE) $(depcomp) \
-	  $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@; \
+	  libtool=no source='$<' object='$@' depfile="$${deps}.Po" tmpdepfile="$${deps}.TPo" depmode=$(CCDEPMODE) $(depcomp) \
+	  $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@; \
 	fi
 
-.c.o:
-	@echo -e "[C]	\033[1m$*\033[0m"
-	set -e; trap "rm -f '.deps/$*.TPo'; exit 1" 1 2 3 5 10 13 15; \
+%.o: %.c
+	@echo -e "[CC ]	\033[1m$<\033[0m"
+	file="$*"; \
+	dirname="$${file%/*}"; \
+	if [ "$${dirname}" = "$${file}" ]; then dirname=.; fi; \
+	file="$${file##*/}"; \
+	deps="$${dirname}/.deps/$${file}"; \
+	set -e; trap "rm -f "$${deps}.TPo"; exit 1" 1 2 3 5 10 13 15; \
 	if [ "$(CCDEPMODE)" = "gcc3" ]; then \
-	  if $(CXX) -MT '$@' -MD -MP -MF '.deps/$*.TPo' $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@; then \
-	    mv '.deps/$*.TPo' '.deps/$*.Po'; \
+	  if $(CC) -MT '$@' -MD -MP -MF "$${deps}.TPo" $(CPPFLAGS) $(CFLAGS) -c $< -o $@; then \
+	    mv "$${deps}.TPo" "$${deps}.Po"; \
 	   else \
-	     rm -f '.deps/$*.TPo'; \
+	     rm -f "$${deps}.TPo"; \
 	     exit 1; \
 	  fi; \
 	else \
-	  libtool=no source='$<' object='$@' depfile='.deps/$*.Po' tmpdepfile='.deps/$*.TPo' depmode=$(CCDEPMODE) $(depcomp) \
-	  $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@; \
+	  libtool=no source='$<' object='$@' depfile="$${deps}.Po" tmpdepfile="$${deps}.TPo" depmode=$(CCDEPMODE) $(depcomp) \
+	  $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@; \
 	fi

+ 42 - 0
build/makehelp.sh

@@ -0,0 +1,42 @@
+#! /bin/sh
+
+echo "/* Generated by $0 */"
+echo "#include \"cmds.h\""
+echo "help_t help[] = {"
+needcomma=0
+IFS="
+"
+sed -e 's,["],\\&,g' | while read -r line; do
+	if [ -n "${line}" -a -z "${line%%:*}" ]; then
+		if [ ${needcomma} -eq 1 ]; then
+			printf "\""
+			[ ${garble} -eq 1 ] && printf ")"
+			printf "},\n"
+		fi
+		line="${line#:}"
+		garble=0
+		if [ "${line%:}" != "${line}" ]; then
+			garble=1
+			line="${line%:}"
+		fi
+		type="${line%:*}"
+		cmd="${line#*:}"
+		[ "${cmd}" = "end" ] && break
+		case ${type} in
+			hub)  type_flag="HUB" ;;
+			leaf) type_flag="LEAF" ;;
+			*)    type_flag="0" ;;
+		esac
+
+		if [ ${garble} -eq 0 ]; then
+			printf "  {%s, \"%s\", 0, \"" ${type_flag} "${cmd}"
+		else
+			printf "  {%s, \"%s\", STR(\"" ${type_flag} "${cmd}"
+	fi
+		needcomma=0
+	else
+		printf "%s\\\n" "${line}"
+		needcomma=1
+	fi
+done
+echo "};"

+ 36 - 0
build/makeres.sh

@@ -0,0 +1,36 @@
+#! /bin/sh
+
+echo "/* Generated by $0 */"
+needcomma=0
+types=
+while read -r line; do
+	[ -z "${line%%#*}" ] && continue # skip comments
+	if [ -n "${line}" -a -z "${line%%:*}" ]; then
+		[ ${needcomma} -eq 1 ] && printf ",\n};\n\n"
+		type="${line#:}"
+		[ "${type}" = "end" ] && break
+		printf "static const char* res_%s[] = {\n" "${type}"
+		needcomma=0
+		types="${types}${types:+ }${type}"
+	else
+		[ ${needcomma} -eq 1 ] && printf ",\n"
+		printf "\t\"%s\"" "${line}"
+		needcomma=1
+	fi
+done
+
+echo "typedef struct {"
+echo "  const char*  name;"
+echo "  const char** res;"
+echo "  const size_t size;"
+echo "} res_t;"
+echo
+echo "static const res_t res[] = {"
+needcomma=0
+for type in ${types}; do
+	[ ${needcomma} -eq 1 ] && printf ",\n"
+	printf "\t{\"%s\",\tres_%s,\tsizeof(res_%s)/sizeof(res_%s[0])}" "${type}" "${type}" "${type}" "${type}"
+	needcomma=1
+done
+echo
+echo "};"

+ 18 - 0
build/makeset.sh

@@ -0,0 +1,18 @@
+#! /bin/sh
+
+echo "/* Generated by $0 */"
+needcomma=0
+while read -r line; do
+	[ -z "${line%%#*}" ] && continue # skip comments
+	if [ -n "${line}" -a -z "${line%%:*}" ]; then
+		[ ${needcomma} -eq 1 ] && printf "\"\n\n"
+		type="${line#:}"
+		[ "${type}" = "end" ] && break
+		printf "#define DEFAULT_%s \"%c\n" $(echo "${type}" | tr '[:lower:]' '[:upper:]') '\'
+		needcomma=0
+	else
+		[ ${needcomma} -eq 1 ] && printf ",%c\n" '\'
+		printf "%s" "${line}"
+		needcomma=1
+	fi
+done

Файловите разлики са ограничени, защото са твърде много
+ 487 - 469
configure


+ 33 - 0
doc/UPDATES

@@ -6,7 +6,32 @@
   bots know which bots have which roles. (#39)
 * Add cmd_roles (leaf only) to display roles for a channel. (#39)
 
+master
+  * Require C++11 compiler support (G++ 4.7+, clang32+)
+
 maint
+  * Disable demo TCL support by default to prevent confusion during build.
+  * Avoid apparmor ptrace(2) warnings on Ubuntu
+  * Allow 'set trace ignore' again. Undoes a change from 2005.
+  * Fix ptrace detection on Linux
+  * Fix broken startup with GCC from ports on FreeBSD.
+  * Fix simulated terminal mode (-nt) defaulting to all console flags.
+  * Fix simulated terminal mode (-nt) not having color supported.
+  * Fix race between DCC and terminal output which could result in
+    bolds being backwards (#86).
+  * Fix TCL warnings during build if TCL is not being used.
+  * Rework the build to parallelize better and rebuild some things less often.
+  * GCC: Always link libstdc++ statically. This avoids distributing
+    a binary that would rely on having a specific compiler version installed
+    and avoids issues when updating the local compiler. This also fixes
+    building a binary with GCC on FreeBSD and using it on a clang-only system.
+  * Fix conversion of command passes from ancient 1.3 format.
+
+1.4.5
+  * Remove ahbl as it now positively identifies all hosts as abusive
+    http://www.ahbl.org/content/last-notice-wildcarding-services-jan-1st
+
+1.4.4
   * Read in /etc/hosts on startup
   * Fix 'bl %group cmd' giving incorrect message when group/bots not found.
   * Fix cmd_slowjoin eating the first channel option (This fixes groups support)
@@ -18,6 +43,14 @@ maint
   * Fix build detecting invalid openssl installations (ones with only static libs)
   * Give hint on bot when disconnected from hub for reason
   * Fix cmd_netnick formatting issue with offline bots
+  * Fix crash when built with clang (FreeBSD)
+  * Binary now uses libelf internally for handling conf data.
+  * Bot responses are now clear and nice. Recompile with your own list if you want
+    in doc/responses.txt
+  * Remove channel limit when limitraise is disabled (#77)
+  * 'fork-interval' removed.
+  * Build with -fstack-protector by default
+  * Remove 60 process limit
 
 1.4.3
   * Default 'set promisc' to ignore since it's usually a false positive

+ 0 - 2
doc/help.txt

@@ -1706,8 +1706,6 @@ See also: reload, backup
 [S]  $bmsg-ident$b           Defines the cmd for identing via msging the bot.
 [S]  $bmsg-release$b         Defines the cmd for releasing a nick.
  
-[N]  $bfork-interval$b       Number of seconds in between each fork() call made by the bot. 
-                         (Resets PID/CPU)
 [R]  $bflood-msg$b           Msgs:Secs until a host is ignored. (0:0 to disable) 
 [R]  $bflood-ctcp$b          Ctcps:Secs until a host is ignored. (0:0 to disable) 
 [R]  $bflood-callerid$b      Msgs:Secs until triggering to set CALLERID for

+ 17 - 200
doc/responses.txt

@@ -1,220 +1,37 @@
 :banned
- bye
- b&
- go away
- unwanted!
- remember when you used to be able to join this channel?
- we're gonna need to go ahead and have you move your stuff down to the basement...
+ Banned
 :kickban
- not wanted
- something tells me you're annoying
- don't bug me lewser
- creep
- you are not banned
- gone
- stupid
- lewser
- ...
+ Banned
 :massdeop
- spammer!
- easy on the modes now
- mode this
- nice try
- really?
- you lose
- scary... really scary...
- i win kthx
- dont tase me bro
- try that again and you will never come back to efnet
- are you tryign to joke me ?
- your time will come soon
- brb loadin up mah bots
- do, or do not. there is no try.
+ Mass deop
 :badop
- neat...
- oh, no you don't. go away.
- didn't you forget something now?
- no
- hijack this
+ Bad op cookie from you
 :badopped
- fuck off kid
- tubgirl wants some love!
- asl?
- whoa... what a hacker... skills!
- yes! yes! yes! hit me baby one more time!
- with your skills, you're better off jacking off than hijacking
- i'll need split all efnet to secure this fucking channel ?
+ Bad op cookie for you
 :bitchop
- channel is +bitch
+ Channel is +bitch
 :bitchopped
- you dont have op access here
+ You dont have op access here
 :manualop
- you think you're special?
- naughty kid
- didn't someone tell you that is bad?
- want perm?
- see how much good that did you?
- not a smart move...
- jackass!
- fuck off
+ Manual opping is not allowed
 :manualopped
- your pal got mean friends. like me.
- uhh now.. don't wake me up...
- hi hun. missed me?
- spammer! die!
- boo!
- that @ was useful, don't ya think
- not in my book
- lol, really?
+ Manually opped
 :closed
- locked
- later
- closed for now
- come back later
- better safe than sorry
- cleanup, come back later
- this channel is closed
- shutting down for now
- lockdown
- reopening later
- not for the public atm
- private channel for now
- might reopen soon, might reopen later
- you're not supposed to be here right now
- sorry, closed
- try us later, atm we're locked down
- closed. try tomorrow
- shutting down spamchan
+ Channel is closed
 :flood
- so much bull in such a short time. amazing.
- slow down. i'm trying to read here.
- uhm... you actually think irc is for talking?
- talk talk talk
- blabbering are we?
- ... and i don't even like you!
- and you're outa here...
- blog it
- dont care
- tell someone who cares
- try here instead http://www.livejournal.com
- care-meter\037:\037 14[5....4..7..8..3..9..14] 140%
+ Flood
 :nickflood
- detected: identity crisis
- make up your mind?
- be schizofrenic elsewhere
- I'm loosing track of you... not
- that is REALLY annoying
- try this: /NICK n00b
- playing hide 'n' seek?
- gotcha!
- you are now known as kicked!
- become who you are.
+ Nick flood
 :kickflood
- you should be a soccer player
- easier to just leave if you wan't to be alone
- cool down
- don't be so damned aggressive. that's my job.
- kicking's fun, isn't it?
- what's the rush?
- next time you do that, i'll kick you again
- and I thought you were a catcher
+ Kick flood
 :revenge
- hey! that wasn't very nice!
- don't fuck with my pals
- don't touch my buddies like that queer
- meanie!
- I can be a bitch too...
- leave the bots alone, will ya?
- not very clever
- watch it
- die
- easy now. that's a friend.
- abuse of power. leave that to me, will ya?
- there as some things you cannot do, and that was one of them...
+ Don't mess with the bots
 :username
- sup
- dont panic
- never forget 12/17/2007!
- a/s/l?\ni'm 17/f/ca ;)
- who are you?
- uhhh do i know you?
- what?
- wtf do you want?
- hold on a second, I am sort of busy..
- mIRC v6.31 File Server\n\nUse: cd dir ls get read help exit\n[\\]
- got any porn?
- ?
- can I help you?
- this better be good.
- haha, I got your ip now!
- you again?
- make it quick
- yes?
- ...
- lost?
- .
- hey..checkout this cool video http://www.youtube.com/watch?v=oHg5SJYRHA0
- SSH-2.0-OpenSSH_4.3p2 Debian-10
- SSH-2.0-OpenSSH_4.3
- SSH-2.0-OpenSSH_4.6p1 FreeBSD-openssh-portable-overwrite-base-4.6.p1,1
- SSH-2.0-OpenSSH_5.1p1 FreeBSD-20080901
- SSH-2.0-OpenSSH_5.2p1 FreeBSD-openssh-portable-overwrite-base-5.2.p1_2,1
- sup g00n
- lol
- whats happenin pimpin?
+ Username?
 :password
- what?
- huh?
- no.
- thats great..
- bzzzzzzzzt, WRONG.
- I don't remember caring..
- good for you.
- I'm going to report you to the RIAA!!!
- who?
- why?
- you're aren't making any sense!
- hurry up so I can get back to this porn
- eh?
- why do you keep bugging me?
- I hear you're gay?
- asl?
- wat
- d/c
- ignored
- I think you got the wrong person...
- ...
- lol
- I have put you on a permanent ignore, public and private. I have found you disturbing, rude and generally not worth talking to.\nAccording to the channels you hang on, it strengtens the effect of wanting to put you on ignore because of my lack of interest in you as a person. This message is not meant to be rude to you, just to inform you that i won't see anything of what you type from now on.
- msg me again and u drop
- how about i do a nice icmp ping, figure out where you are and what you are on, spawn your command.com to a port of my choice and log in with telnet and have a field day with you.
+ Password?
 :baduserpass
- stop wasting my time.
- gtg
- go away
- go away already
- fuck off already
- ehh..no, bye.
- you're still here?
- jesus loves you, but I ain't jesus. \002FUCK OFF\002
- stop bugging me.
- haha, I'm going to tell everyone that!
- lost?
- cya
- oops?
- leave me alone.
- ...?
- whatever man, cya
- lewser
- try again, newb
- newb
- haha, no.
- lol
- dont care
- d/c
- reporting you for spam.
- Congratulations, prick, you've just made my ignore list. Was it worth it to you to make your 'witty' comments and snide in-jokes to your irc pals about me if it meant you are now disappeared from my online experience? Have a nice life.
- brb getting u glined
+ Invalid username/password
 :mIRCver
  5.91
  6.01

+ 0 - 4
doc/settings.txt

@@ -21,11 +21,9 @@ irc.eversible.com
 irc.mzima.net
 irc.paraphysics.net
 irc.servercentral.net
-irc.shoutcast.com
 irc.umich.edu
 irc2.choopa.net
 #EU
-efnet.cs.hut.fi
 efnet.port80.se
 efnet.portlane.se
 efnet.xs4all.nl
@@ -61,7 +59,6 @@ irc.choopa.net:9999
 irc.eversible.com:9999
 irc.paraphysics.net
 irc.servercentral.net:9999
-irc.shoutcast.com:8000
 irc.umich.edu:9999
 irc.underworld.no
 
@@ -73,7 +70,6 @@ irc.ipv6.paraphysics.net
 irc.underworld.no
 
 :rbl
-dnsbl.ahbl.org
 dnsbl.proxybl.org
 rbl.efnetrbl.org
 tor.efnet.org

+ 21 - 5
lib/Makefile.in

@@ -1,23 +1,29 @@
 
 SHELL = @SHELL@
 top_srcdir = @top_srcdir@
+top_builddir = @top_builddir@
 srcdir = @srcdir@
 VPATH = @srcdir@
+LIBELF_BUNDLED = @LIBELF_BUNDLED@
 
 @SET_MAKE@
 
 #include $(top_srcdir)/build/build.mk
 
-.PHONY: default clean distclean normal debug general buildcheck notice notice_debug build units
+.PHONY: default clean distclean normal debug general buildcheck notice notice_debug build units libelf libelf_notice bdlib
 
 default: normal
 
 clean:
 	-+@cd bdlib && $(MAKE) clean
+	-+@[ -n "${LIBELF_BUNDLED}" ] && [ -f libelf/Makefile && \
+	    cd libelf && $(MAKE) clean
 	@rm -f *.a
 
 distclean: clean
 	-+@cd bdlib && $(MAKE) distclean
+	-+@[ -n "${LIBELF_BUNDLED}" ] && [ -f libelf/Makefile ] && \
+	    cd libelf && $(MAKE) distclean
 
 notice:
 	@echo "[*] Making libraries"
@@ -31,11 +37,21 @@ debug: general notice_debug build.debug
 
 general:
 
-build:
-	+@cd bdlib && $(MAKE) bdlib
+libelf_notice:
+	@echo "[*] Building libelf"
 
-build.debug:
-	+@cd bdlib && $(MAKE) debug
+$(top_builddir)/lib/libelf/lib/libelf.a: libelf_notice
+	+@cd libelf/lib && $(MAKE) CFLAGS="-g -O2 -w" libelf.a
+
+libelf: $(LIBELF_BUNDLED)
+
+$(top_builddir)/lib/bdlib/libbdlib.a:
+	+@cd bdlib && $(MAKE)
+
+bdlib: $(top_builddir)/lib/bdlib/libbdlib.a
+
+build: $(top_builddir)/lib/bdlib/libbdlib.a $(LIBELF_BUNDLED)
+build.debug: $(top_builddir)/lib/bdlib/libbdlib.a $(LIBELF_BUNDLED)
 
 buildcheck: build
 

+ 1 - 1
lib/bdlib

@@ -1 +1 @@
-Subproject commit b0e505af2cf29bbd9b220aa7b405fb2219f67f35
+Subproject commit 9ee3b7d844e076a7ce5c668d31f1d899c978790b

+ 481 - 0
lib/libelf/COPYING.LIB

@@ -0,0 +1,481 @@
+		  GNU LIBRARY GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+    		    59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL.  It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it.  You can use it for
+your libraries, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library.  If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software.  To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+  Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs.  This
+license, the GNU Library General Public License, applies to certain
+designated libraries.  This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+  The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it.  Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program.  However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+  Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries.  We
+concluded that weaker conditions might promote sharing better.
+
+  However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves.  This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them.  (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.)  The hope is that this
+will lead to faster development of free libraries.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+  Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+		  GNU LIBRARY GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License").  Each licensee is
+addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    c) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    d) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!

+ 1435 - 0
lib/libelf/ChangeLog

@@ -0,0 +1,1435 @@
+Sun Nov  1 14:08:47 CET 2009, Michael Riepe <libelf@mr511.de>
+
+	* README:
+	* VERSION:
+		update for 0.8.13 release.
+	* libelf.pc.in:
+		add -I${includedir}.
+	* lib/begin.c:
+	* lib/private.h:
+		move archive related declarations.
+	* lib/elf_repl.h:
+		disable Elf64_Cap for 32-bit build.
+	* lib/getaroff.c:
+		new file.
+	* lib/Makefile.in:
+	* lib/Makefile.w32:
+		add getaroff.c.
+
+Tue Jul  7 19:45:12 CEST 2009, Michael Riepe <libelf@mr511.de>
+
+	* README:
+	* VERSION:
+		update for 0.8.12 release.
+
+	* lib/libelf.h:
+	* lib/x.elfext.c:
+		add new and deprecate old functions.
+ 
+Fri May 22 19:17:14 CEST 2009, Michael Riepe <libelf@mr511.de>
+
+	* README:
+	* VERSION:
+		update for 0.8.11 release.
+
+	* lib/libelf.h:
+		add ELF_F_LAYOUT_OVERLAP flag.
+
+	* lib/rawfile.c:
+		fix re-read zero size bug.
+
+	* lib/update.c:
+		honor ELF_F_LAYOUT_OVERLAP flag.
+
+Fri Sep  7 14:04:20 CEST 2007, Michael Riepe <libelf@mr511.de>
+
+	* acconfig.h:
+		add ENABLE_SANITY_CHECKS.
+
+	* aclocal.m4:
+		fix --enable-gnu-names.
+
+	* configure.in:
+		add --enable-sanity-checks.
+		fix --enable-extended-format.
+
+	* lib/data.c:
+		add _elf_sanity_checks variable.
+
+	* lib/private.h:
+		declare _elf_sanity_checks and constants.
+
+	* lib/strptr.c:
+		enable/disable sanity check.
+
+	* lib/version.c:
+		set _elf_sanity_checks from $LIBELF_SANITY_CHECKS.
+
+Fri Jun 29 23:27:15 CEST 2007, Michael Riepe <libelf@mr511.de>
+
+	* lib/Makefile.in:
+		improved make -jX patch.
+
+Wed Jun 20 08:04:30 CEST 2007, Michael Riepe <libelf@mr511.de>
+
+	* lib/Makefile.in:
+		add "make -jX install" patch by Joel Martin.
+
+Tue Nov 21 21:21:12 CET 2006, Michael Riepe <libelf@mr511.de>
+
+	* lib/Makefile.w32:
+		fix Windows compilation bug.
+
+Thu Sep  7 17:55:42 CEST 2006, Michael Riepe <libelf@mr511.de>
+
+	* acconfig.h:
+	* aclocal.m4:
+	* configure.in:
+	* lib/config.h.w32:
+	* lib/gelf.h:
+	* lib/private.h:
+	* lib/sys_elf.h.in:
+	* lib/sys_elf.h.w32:
+		port to QNX Neutrino, thanks to darkelf.
+
+Fri Aug 25 14:46:34 CEST 2006, Michael Riepe <libelf@mr511.de>
+
+	* Makefile.in:
+		add trackinstall target.
+
+Mon Aug 21 20:26:47 CEST 2006, Michael Riepe <libelf@mr511.de>
+
+	* Makefile.in:
+		drop w32 from DISTSUBDIRS.
+	* lib/Makefile.in:
+		add new files to DISTFILES.
+	* lib/Makefile.w32:
+	* lib/build.bat:
+	* lib/config.h.w32:
+	* lib/libelf.def:
+	* lib/sys_elf.h.w32:
+		adopted from w32 subdirectory.
+
+Fri Aug 18 02:04:58 CEST 2006, Michael Riepe <libelf@mr511.de>
+
+	* lib/begin.c:
+		let getnum return a size_t.
+	* lib/libelf.h:
+		replace __value because it's a reserved word in VC++ 2005.
+	* lib/nlist.c:
+		don't declare open() on W32.
+	* lib/private.h:
+		use <io.h> on W32.
+	* w32/Makefile.w32:
+		fix W32 DLL build.
+	* w32/build.bat:
+		add more examples for vcvars32.bat location.
+
+Fri Jul 28 00:56:00 CEST 2006, Michael Riepe <libelf@mr511.de>
+
+	* lib/32.xlatetof.c:
+	* lib/64.xlatetof.c:
+		check for dsize == -1.
+	* lib/verdef.h:
+	* lib/verneed.h:
+		improve section translators.
+
+Tue Jul 11 18:53:00 CEST 2006, Michael Riepe <libelf@mr511.de>
+
+	* w32/libelf.def:
+		add missing functions.
+
+Sat Jul  8 00:50:00 CEST 2006, Michael Riepe <libelf@mr511.de>
+
+	* VERSION:
+		bump up to 0.8.9.
+
+Sat Jul  8 00:17:00 CEST 2006, Michael Riepe <libelf@mr511.de>
+
+	* lib/32.newehdr.c:
+		make return value compatible with Solaris.
+	* lib/32.newphdr.c:
+		handle 65535+ segments.
+		make return value compatible with Solaris.
+	* lib/cook.c:
+		handle 65535+ segments.
+	* lib/elf_repl.h:
+		add new definitions.
+	* lib/libelf.h:
+		add/rename functions.
+	* lib/newscn.c:
+		fix section creation (was broken in 0.8.7).
+	* lib/private.h:
+		add SHN_XINDEX and PN_XNUM in case they're missing.
+		centrally define LIBELF_SUCCESS and LIBELF_FAILURE.
+	* lib/update.c:
+		handle 65535+ segments.
+		use elf->e_phnum internally.
+	* lib/x.elfext.c:
+		add elf_getphnum().
+		rename elfx_get_shnum() and elfx_get_shstrndx().
+		make return values compatible with Solaris.
+
+Fri Jul  7 19:01:04 CEST 2006, Michael Riepe <libelf@mr511.de>
+
+	* VERSION:
+		bump up to 0.8.8.
+
+Fri Jul  7 18:27:25 CEST 2006, Michael Riepe <libelf@mr511.de>
+
+	* lib/Makefile.in:
+		add lib/x.elfext.c.
+	* lib/libelf.h:
+		add functions from lib/x.elfext.c.
+	* lib/newscn.c:
+		simplify _elf_update_shnum().
+
+Tue Apr 25 16:26:39 CEST 2006, Michael Riepe <libelf@mr511.de>
+
+	* lib/gelf.h:
+	* lib/libelf.h:
+	* lib/nlist.h:
+	* lib/private.h:
+		add workaround for broken compilers.
+
+Mon Apr 24 16:24:32 CEST 2006, Michael Riepe <libelf@mr511.de>
+
+	* po/de.po:
+		update.
+
+Fri Apr 21 19:17:46 CEST 2006, Michael Riepe <libelf@mr511.de>
+
+	* acconfig.h:
+	* configure.in:
+		add --enable-extended-format.
+	* aclocal.m4:
+		search for msgmerge.
+	* lib/cook.c:
+		change _elf_item buffering.
+		handle extended format (with unusual entsize).
+	* lib/errors.h:
+	 	add ERROR_EHDR_SHENTSIZE and ERROR_EHDR_PHENTSIZE.
+	* po/Makefile.in:
+		use msgmerge instead of tupdate.
+ 
+Thu Oct 20 21:08:02 CEST 2005, Michael Riepe <libelf@mr511.de>
+
+	* lib/input.c:
+	* lib/update.c:
+		handle partial reads and writes.
+
+Tue Aug 16 01:48:17 CEST 2005, Michael Riepe <libelf@mr511.de>
+
+	* lib/begin.c:
+		add workaround for archive member misalignment.
+	* VERSION:
+		bump up to 0.8.7
+
+Tue Jul 19 11:56:26 CEST 2005, Michael Riepe <libelf@mr511.de>
+
+	* README:
+	* w32/build.bat:
+		update.
+	* w32/libelf.def:
+		fix syntax.
+
+Tue Jun 28 00:31:24 CEST 2005, Michael Riepe <libelf@mr511.de>
+
+	* Makefile.in:
+		remove superfluous slash.
+
+Tue Jun 21 03:58:47 CEST 2005, Michael Riepe <libelf@mr511.de>
+
+	* lib/Makefile.in:
+		get rid of lib/pic subdir.
+
+Sat May 21 17:39:28 CEST 2005, Michael Riepe <libelf@mr511.de>
+
+	* (global):
+		remove my e-mail address from all copyright clauses.
+
+Sun May 15 23:08:30 CEST 2005, Michael Riepe <libelf@mr511.de>
+
+	* configure.in:
+		check if $CC can copile <elf.h>.
+	* lib/private.h:
+		#include <stdint.h> before <sys/types.h> (fixes glibc bug).
+
+Sun May  8 23:40:35 CEST 2005, Michael Riepe <libelf@mr511.de>
+
+	* Makefile.in:
+		add instroot variable.
+		install libelf.pc.
+	* configure.in:
+		create libelf.pc.
+
+Sun Mar 20 15:41:22 CET 2005, Michael Riepe <libelf@mr511.de>
+
+	* (global):
+		change my e-mail address.
+
+Fri Jan 28 23:09:57 CET 2005, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* po/Makefile.in:
+		use modified gmo2msg.
+	* po/gmo2msg.c:
+		make gmo2msg output more portable.
+
+Thu Oct  7 11:37:09 CEST 2004, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/cook.c:
+		only use Elf64_Shdr if __LIBELF64 is true.
+
+Fri Sep 17 02:55:47 CEST 2004, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/elf_repl.h:
+		add some ABI and architecture definitions.
+	* w32/config.h:
+		manual update.
+
+Sat Jul 10 17:33:15 CEST 2004, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* acconfig.h:
+	* aclocal.m4:
+	* lib/errmsg.c:
+		check for dgettext, not for gettext.
+	* configure.in:
+		check for -lintl.
+	* po/Makefile.in:
+		use -lintl when building gmo2msg.
+
+Sun Jul  4 23:57:21 CEST 2004, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* Makefile.in:
+		add w32 subdir.
+	* README:
+		update for 0.8.6.
+	* configure.in:
+		create w32/Makefile.
+
+Sat Jul  3 20:42:00 CEST 2004, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/32.xlatetof.c:
+	* lib/64.xlatetof.c:
+	* lib/Makefile.in:
+		give up on <libelf_u.h>.
+	* lib/getarsym.c:
+
+Wed Jun 23 01:07:46 CEST 2004, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* config.guess:
+	* config.sub:
+		update from FSF.
+
+Tue May  4 22:02:01 CEST 2004, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* config.guess:
+	* config.sub:
+		update from FSF.
+
+Tue Mar 30 15:09:00 CEST 2004, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/32.xlatetof.c:
+	* lib/64.xlatetof.c:
+	* lib/Makefile.in:
+		use <libelf_u.h> to work around W32 compiler problems.
+
+Mon Feb 16 06:19:11 CET 2004, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* Makefile.in:
+		generate old-format tar file.
+
+Sat Jan 24 03:42:39 CET 2004, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/32.xlatetof.c:
+	* lib/64.xlatetof.c:
+		replace NULL with 0 -- some compilers don't like (void*).
+	* lib/getarsym.c:
+	* lib/nlist.c:
+		add cast to suppress compiler warning.
+
+Fri Jan 23 05:11:46 CET 2004, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/update.c:
+		#undef max before #define.
+
+Wed Jan 21 18:15:50 CET 2004, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/begin.c:
+		better support for Cygwin .lib archive files.
+
+Mon Jan 19 15:36:21 CET 2004, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/libelf.h:
+	* lib/memset.c:
+		include <stddef.h> unconditionally.
+
+Fri Jan 16 23:13:25 CET 2004, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* aclocal.m4:
+		support Intel C Compiler.
+	* lib/32.newehdr.c:
+	* lib/32.newphdr.c:
+		remove elf->e_free_ehdr and elf->e_free_phdr.
+	* lib/cook.c:
+		always allocate ehdr and phdr.
+	* lib/end.c:
+		always deallocate ehdr and phdr.
+	* lib/private.h:
+		remove elf->e_free_ehdr and elf->e_free_phdr.
+		change valid_type to suppress compiler warning.
+	* lib/update.c:
+		not necessary to update elf->e_ehdr and elf->e_phdr.
+
+Thu Jan 15 22:43:00 CET 2004, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* VERSION:
+		bump up to 0.8.6.
+	* configure.in:
+		check for __int64.
+	* lib/32.xlatetof.c:
+	* lib/64.xlatetof.c:
+	* lib/gelf.h:
+	* lib/nlist.h:
+		test _WIN32 macro.
+	* lib/begin.c:
+		add (off_t) cast to suppress compiler warning.
+	* lib/libelf.h:
+	* lib/memset.c:
+		conditionally include <stddef.h> for size_t.
+	* lib/nlist.c:
+		declare open() on W32 systems.
+
+Tue Dec 16 20:02:30 CET 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* Makefile.in:
+		let disttest target make dist again.
+
+Sat Dec 13 16:14:31 CET 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/update.c:
+		call lseek before ftruncate.
+
+Fri Dec  5 16:25:16 CET 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* aclocal.m4:
+		add explanation for --enable-maintainer-mode
+	* lib/Makefile.in:
+	* po/Makefile.in:
+		add instroot make variable
+	* README:
+		add hint how to use it
+
+Thu Nov  6 17:35:00 CET 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* Makefile.in:
+	* lib/Makefile.in:
+	* po/Makefile.in:
+		add check targets
+		add MANIFEST to distribution
+	* aclocal.m4:
+		add mr_PACKAGE macro
+	* configure.in:
+		use mr_PACKAGE macro
+
+Sat Oct 25 15:22:59 CEST 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/elf_repl.h:
+		add EM_SPARC64
+
+Thu Oct  9 23:08:56 CEST 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/x.movscn.c:
+	* lib/x.remscn.c:
+		verify that file is really an ELF file
+
+Wed Oct  8 17:10:09 CEST 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* config.guess:
+	* config.sub:
+		latest versions from FSF
+
+Sat May 24 18:55:14 CEST 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* config.guess:
+		latest version from FSF
+	* lib/Makefile.in:
+	* lib/libelf.h:
+	* lib/x.movscn.c:
+	* lib/x.remscn.c:
+		add elfx_movscn() and elfx_remscn()
+	* lib/newscn.c:
+		update e_shnum properly
+	* lib/private.h:
+		declare _elf_update_shnum()
+
+Fri May 23 18:25:48 CEST 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* aclocal.m4:
+		provide name suffixes only
+	* lib/Makefile.in:
+		use name suffixes
+
+Fri May 23 01:24:26 CEST 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* README:
+		update for 0.8.5
+		add section about LFS
+	* config.guess:
+		latest version from FSF
+	* configure.in:
+	* lib/Makefile.in:
+		use local pic object directory
+	* lib/checksum.c:
+		detect d_buf == NULL
+
+Sun May 18 16:49:10 CEST 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* VERSION:
+		bump up to 0.8.5
+	* lib/strptr.c:
+		make elf_strptr() work safely with fragmented string tables
+	* lib/errors.h:
+		new error code and message for elf_strptr()
+	* po/de.po:
+	* po/libelf.po:
+		regenerated
+
+Mon May 12 15:29:12 CEST 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/update.c:
+		improved fix for elf_update `null buffer' bug
+
+Mon May 12 00:34:44 CEST 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* config.guess:
+	* config.sub:
+		latest versions from FSF
+
+Sun May 11 01:44:06 CEST 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/verdef.h:
+	* lib/verneed.h:
+		fix elf_update `null buffer' error.
+		Thanks to Bart Trojanowski who reported the bug.
+
+Wed May  7 20:26:17 CEST 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* configure.in:
+		fix maintainer mode default
+	* lib/verdef.h:
+	* lib/verneed.h:
+		only check d_buf if there is at least one element
+
+Mon Mar 31 17:08:04 CEST 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* VERSION:
+		bump up to 0.8.4
+
+Sun Mar 23 16:06:43 CET 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* configure.in:
+		fix --enable-compat
+
+Thu Feb 27 14:35:12 CET 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* Makefile.in:
+		add `test-dist' target
+	* lib/errors.h:
+		new error code
+	* po/de.po:
+	* po/libelf.pot:
+		regenerated
+
+Wed Feb 26 17:48:58 CET 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* config.guess:
+	* config.sub:
+		latest versions from FSF
+
+Wed Jan 15 22:50:53 CET 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/begin.c:
+		fix overflow check
+
+Sun Jan 12 04:27:31 CET 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* configure.in:
+		prefer int for __libelf_i32_t (if int has 32 bits)
+
+Thu Jan  2 17:40:22 CET 2003, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* README:
+		update for 0.8.3
+	* config.guess:
+	* config.sub:
+		update from ftp.gnu.org
+	* lib/cook.c:
+		require space for one SHDR only
+	* lib/elf_repl.h:
+		fix DT_ENCODING value
+
+Tue Dec 31 16:27:19 CET 2002, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/cook.c:
+		honor ELF extensions for >= 0xff00 sections
+	* lib/elf_repl.h:
+		add definitions from lates ELF spec
+	* lib/errors.h:
+	* po/libelf.pot:
+	* po/de.po:
+		new error message
+	* lib/private.h:
+		define missing pieces
+	* lib/update.c:
+		handle >= 0xff00 sections
+
+Mon Dec 23 00:23:20 CET 2002, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/Makefile.in:
+		fix dependencies.
+	* lib/cook.c:
+		add quirks mode for broken 64-bit architectures.
+	* lib/update.c:
+		do not override sh_entsize unless it's set to 0.
+	* lib/verdef.h:
+	* lib/verneed.h:
+		work around possible SEGV in translation routines.
+
+Sat Dec 14 23:33:10 CET 2002, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* ChangeLog:
+		add missing entries for 0.8.2 release.
+	* VERSION:
+		bump up to 0.8.3.
+	* lib/32.xlatetof.c:
+	* lib/64.xlatetof.c:
+	* lib/verdef.h:
+	* lib/verneed.h:
+		fix ISO C violations (required for MacOS X).
+	* po/gmo2msg.c:
+		create SUSv3 compliant .msg files.
+
+Thu Jun 11 19:00:19 CEST 2002, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* README:
+		update for 0.8.2.
+	* VERSION:
+		bump up to 0.8.2.
+	* lib/32.xlatetof.c:
+	* lib/64.xlatetof.c:
+		fix typos in for loop.
+	* lib/nlist.c:
+		add O_BINARY to file mode
+		(defaults to 0 on systems that lack it).
+
+Tue Dec 25 14:42:51 CET 2001, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* VERSION:
+		set version to 0.8.0.
+	* README:
+		update version.
+
+Tue Oct 30 17:05:03 CET 2001, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* Makefile.in:
+		use uid/gid=0 when creating the distribution tar file.
+
+Mon Oct 15 23:47:10 CEST 2001, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* configure.in:
+		check for <ar.h> and <fcntl.h>.
+		create ./pic when configuring.
+	* lib/Makefile.in:
+		move .o to ../pic/$@, not ../pic.
+	* lib/begin.c:
+		define struct ar_hdr and friends if <ar.h> is missing.
+		use lseek(..., SEEK_END).
+	* lib/input.c:
+		use lseek(..., SEEK_SET).
+	* lib/nlist.c:
+		include <fcntl.h> conditionally.
+		define O_RDONLY if it is missing.
+	* lib/private.h:
+		define SEEK_{SET,CUR,END} if they're missing.
+	* lib/update.c:
+		explicitly pass file descriptor to _elf_output().
+		use lseek(..., SEEK_SET).
+
+Tue Oct  9 22:46:01 CEST 2001, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* aclocal.m4:
+		remove superfluous case.
+
+Mon Oct  8 17:56:04 CEST 2001, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/opt.delscn.c:
+		handle versioning sections properly.
+
+Mon Oct  8 17:02:43 CEST 2001, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/32.xlatetof.c:
+	* lib/64.xlatetof.c:
+		override encoding when calculating the destination buffer
+		size for translation to a file.
+
+Sun Oct  7 21:31:01 CEST 2001, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* configure.in:
+		drop OBJS64; always compile 64-bit sources.
+	* lib/32.xlatetof.c:
+	* lib/64.xlatetof.c:
+		add translators for versioning structures.
+	* lib/Makefile.in:
+		drop OBJS64; add versioning support files.
+	* lib/errors.h:
+		add error codes for versioning support.
+	* lib/gelfehdr.c:
+	* lib/gelfphdr.c:
+	* lib/gelfshdr.c:
+	* lib/gelftrans.c:
+	* lib/swap64.c:
+		guard code with `#if __LIBELF64'.
+	* lib/private.h:
+		add translator declarations.
+	* po/de.po:
+	* po/libelf.pot:
+		add error messages for versioning support.
+
+Sun Oct  7 16:54:15 CEST 2001, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* acconfig.h:
+	* configure.in:
+		improve auto-configuration.
+	* lib/Makefile.in:
+	* po/Makefile.in
+		let users override distdir.
+	* lib/cook.c:
+		improved bugfix based on new auto-configuration.
+	* lib/getdata.c:
+		prepare src first to prevent SEGV.
+	* lib/private.h:
+	* lib/update.c:
+		cosmetic changes.
+
+Sun Oct  7 05:50:19 CEST 2001, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* configure.in:
+	* lib/cook.c:
+		fix compilation problem on Linux (SHT_SUNW_ver* undefined).
+	* lib/32.xlatetof.c:
+	* lib/64.xlatetof.c:
+		make translator functions calculate the destination size.
+		add _elf32_xltsize and _elf64_xltsize entry points.
+	* lib/private.h:
+		declare _elf32_xltsize and _elf64_xltsize.
+	* lib/getdata.c:
+	* lib/update.c:
+		use _elf32_xltsize and _elf64_xltsize.
+
+Fri Oct  5 20:35:31 CEST 2001, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/elf_repl.h:
+		add DT_VERSYM.
+	* lib/ext_types.h:
+		correct type names.
+	* lib/libelf.h:
+		add ELF_T_VDEF and ELF_T_VNEED.
+	* lib/32.fsize.c:
+		add table entries for versioning structures.
+	* lib/cook.c:
+		replace _elf_scn_types[] with _elf_scn_type().
+	* lib/private.h:
+		likewise; also remove valid_scntype() macro.
+	* lib/update.c:
+		call _elf_scn_type(), but do not set sh_entsize
+		for ELF_T_VDEF / ELF_T_VNEED.
+	* acconfig.h:
+	* lib/sys_elf.h.in:
+		added __LIBELF_SYMBOL_VERSIONS.
+	* configure.in:
+		check for symbol versioning definitions.
+	* lib/Makefile.in:
+		added gelf.h dependency.
+
+Wed Oct  3 22:46:33 CEST 2001, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/swap64.c:
+		new file; separate 64-bit functions.
+	* lib/64.xlatetof.c:
+		remove 64-bit conversion functions.
+	* lib/byteswap.h:
+		replace casts to long / unsigned long.
+		add prototypes for 64-bit conversion functions.
+	* configure.in:
+	* lib/Makefile.in:
+		add lib/swap64.c.
+	* lib/ext_types.h:
+		add type definitions for versioning.
+	* lib/elf_repl.h:
+	* lib/gelf.h:
+		cosmetic changes.
+
+Wed Oct  3 00:00:27 CEST 2001, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/elf_repl.h:
+		added lots of new definitions.
+	* lib/gelf.h:
+	* lib/libelf.h:
+	* lib/sys_elf.h.in:
+		cosmetic changes.
+
+Fri Sep 28 22:42:36 CEST 2001, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/32.xlatetof.c:
+	* lib/64.xlatetof.c:
+		remove `const' when compiling with -fPIC.
+
+Fri Sep 28 20:14:42 CEST 2001, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* README:
+		add pointers to documentation.
+	* lib/64.xlatetof.c:
+		fixed conversion thinko.
+		(Jakub Jelinek <jakub@redhat.com> found this - thanks!)
+	* lib/gelf.h:
+	* lib/32.fsize.c:
+		add gelf_msize.
+	* lib/libelf.h:
+		add comment that elf{32,64}_checksum is missing.
+
+Tue Sep 11 02:43:47 CEST 2001, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* README:
+		corrected typo.
+	* lib/cook.c:
+	* lib/private.h:
+	* lib/update.c:
+		replaces _ELFxx_ALIGN_xHDR with _fsize() call.
+
+Sun Sep  2 20:58:09 CEST 2001, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* Makefile.in:
+	* configure.in:
+	* lib/Makefile.in:
+	* po/Makefile.in:
+		add maintainer mode.
+
+Sat Sep  1 15:11:42 CEST 2001, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/sys_elf.h.in: add more fixes for broken <elf.h> files.
+
+Sat Sep  1 05:01:16 CEST 2001, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* ChangeLog: major update. Yes, I'm back.
+
+	* COPYING.LIB: updated version from FSF.
+
+	* README: updated for 0.7.1.
+
+Thu Apr 20 17:09:41 CEST 2000, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/gelftrans.c:
+	* lib/elf_repl.h:
+		add explicit casts to ELF64_R_SYM and ELF64_R_INFO.
+
+Thu Apr 13 20:15:45 CEST 2000, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/update.c: better checks for overlapping sections.
+
+	* lib/errors.h:
+	* po/de.po:
+	* po/libelf.pot:
+		new error message.
+
+Thu Apr  6 19:15:46 CEST 2000, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/strptr.c: rename `sd' variable.
+
+Fri Mar 31 20:11:14 CEST 2000, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* Makefile.in: also pass CPPFLAGS and LDFLAGS to config.status.
+
+Fri Mar 31 20:02:55 CEST 2000, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* aclocal.m4: add -DPIC define when building position-independent code.
+
+	* lib/32.xlatetof.c:
+	* lib/64.xlatetof.c:
+	* lib/errmsg.c:
+		make array members const when PIC is undefined.
+
+Fri Mar 31 14:42:32 CEST 2000, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/32.newehdr.c: make _elf_newehdr() function private again.
+
+	* lib/32.newphdr.c: make _elf_newphdr() function private again.
+
+	* lib/strptr.c: add support for 64-bit ELF format.
+
+Wed Mar 29 18:49:43 CEST 2000, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/gelfshdr.c: remove ELF class check.
+
+Mon Mar 27 01:24:50 CEST 2000, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/gelf.h: #include <libelf.h> when compiling libelf.
+
+Sun Mar 26 15:02:54 CEST 2000, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/private.h: #include <gelf.h> header file.
+
+	* lib/gelfehdr.c: move gelf_newehdr() function to lib/32.newehdr.c.
+
+	* lib/gelfphdr.c: move gelf_newphdr() function to lib/32.newphdr.c.
+
+	* lib/32.newehdr.c: add gelf_newehdr() function.
+
+	* lib/32.newphdr.c: add gelf_newphdr() function.
+
+	* lib/gelfshdr.c:
+	* lib/gelftrans.c:
+		remove explicit <gelf.h> include.
+
+Sun Mar 26 06:22:20 CEST 2000, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* acconfig.h:
+	* configure.in:
+	* lib/private.h:
+	* lib/sys_elf.h.in:
+		rename NEED_LINK_H to __LIBELF_NEED_LINK_H.
+
+	* lib/32.newehdr.c: make _elf_newehdr() function public.
+
+	* lib/32.newphdr.c: make _elf_newphdr() function public.
+
+	* lib/gelf.h:
+		include <link.h> if needed.
+		choke if 64-bit is not supported.
+		add generic versions of ELF32_* and ELF64_* macros.
+
+	* lib/gelftrans.c:
+		define ELF32_R_* and ELF64_R_* macros (missing on some systems).
+
+Sun Mar 26 05:27:15 CEST 2000, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* configure.in:
+		add check for existing <gelf.h> header.
+		build new source files when 64-bit is enabled.
+
+	* lib/Makefile.in:
+		add new source files.
+		make install-compat if --enable-compat was given.
+
+	* po/de.po:
+	* po/libelf.pot:
+		new error messages.
+
+Sun Mar 26 05:00:20 CEST 2000, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* Makefile.in:
+	* lib/Makefile.in:
+	* po/Makefile.in:
+		remove Makefile last in `make distclean'.
+
+	* aclocal.m4: explicitly state the default in --enable-* help texts.
+
+	* configure.in:
+		set ALL_LINGUAS automatically.
+		add `--enable-compat' option.
+
+	* lib/private.h: add sd_scn member to struct Scn_Data.
+
+	* lib/cook.c:
+	* lib/end.c:
+	* lib/getdata.c:
+	* lib/newdata.c:
+	* lib/opt.delscn.c:
+	* lib/rawdata.c:
+	* lib/update.c:
+		handle new sd_scn member.
+
+	* lib/gelf.h: new public header file.
+
+	* lib/gelfehdr.c: new file, implements the gelf_getehdr(),
+		gelf_update_ehdr() and gelf_newehdr() functions.
+
+	* lib/gelfphdr.c: new file, implements the gelf_getphdr(),
+		gelf_update_phdr() and gelf_newphdr() functions.
+
+	* lib/gelfshdr.c: new file, implements the gelf_getshdr()
+		and gelf_update_shdr() functions.
+
+	* lib/gelftrans.c: new file, implements the gelf_getsym(),
+		gelf_update_sym(), gelf_getdyn(), gelf_update_dyn(),
+		gelf_getrela(), gelf_update_rela(), gelf_getrel() and
+		gelf_update_rel() functions.
+
+	* lib/begin.c: add gelf_getclass() function.
+
+	* lib/32.fsize.c: add gelf_fsize() function.
+
+	* lib/32.getphdr.c: make _elf_getphdr() function public.
+
+	* lib/64.xlatetof.c:
+		add gelf_xlatetom() and gelf_xlatetof() functions.
+		remove `const' from array members.
+
+	* lib/errors.h: add GElf error messages.
+
+	* po/de.po:
+	* po/libelf.pot:
+		new error message.
+
+Thu Nov  4 21:17:34 CET 1999, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/32.xlatetof.c:
+	* lib/errmsg.c:
+	* po/gmo2msg.c:
+		remove `const' from array members.
+
+Thu Nov  4 20:16:36 CET 1999, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/Makefile.in: add assert.c; remove stamp-h in `make distclean'.
+
+	* lib/assert.c: new file, implements the __elf_assert() function.
+
+	* lib/private.h: use __elf_assert() in elf_assert() macro.
+
+Wed Mar 17 16:21:02 CET 1999, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* configure.in: add "de" to ALL_LINGUAS.
+
+	* lib/elf_repl.h: lots of new #defines.
+
+	* lib/hash.c:
+	* lib/libelf.h:
+		elf_hash() takes an `const unsigned char *'.
+
+	* po/gmo2msg.c: copy comments from .gmo file.
+
+Fri Mar  5 16:28:08 CET 1999, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* VERSION: set version to 0.7.1.
+
+	* po/de.po: new file.
+
+Fri Nov 27 22:24:00 MET 1998, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/memset.c: rename and rewrite.
+	* lib/private.h: rename __memset.
+
+Tue Aug 25 17:17:18 MEST 1998, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* aclocal.m4: remove superfluous #include.
+
+	* lib/32.xlatetof.c:
+	* lib/64.xlatetof.c: fix for picky instances of cpp(1).
+
+Sun Aug 23 18:26:53 MEST 1998, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* aclocal.m4:
+	* lib/Makefile.in: add DEPSHLIBS, set to -lc for Linux.
+
+	* README: add DEPSHLIBS description.
+
+Sat Aug 22 15:50:41 MEST 1998, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/begin.c: add workaround for broken ar(1) & friends.
+
+	* lib/32.getshdr.c: fix typo.
+
+Thu Aug  6 18:11:52 MEST 1998, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/getdata.c: fixed SEGV bug.
+
+	* lib/cook.c:
+	* lib/getdata.c:
+	* lib/newdata.c:
+	* lib/rawdata.c:
+	* lib/private.h: removed sd_scn and (Elf_Data*) casts.
+
+Fri Jun 12 21:24:50 MEST 1998, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* lib/*.c: move rcsid[] after <private.h>.
+
+	* lib/32.xlatetof.c:
+	* lib/64.xlatetof.c: replace broken Exn() macro with Cat2().
+
+	* lib/64.xlatetof.c: change `char*' to `unsigned char*'.
+
+	* lib/private.h: add `extern char *realloc();'.
+
+	* aclocal.m4:
+	* configure.in: remove leading spaces in cpp directives.
+
+Sun Jun  7 16:02:31 MEST 1998, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* README: update for 0.7.0 release.
+
+Sun Jun  4 15:26:49 MEST 1998, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* acconfig.h: add __libelf64* and __libelf_*_t.
+
+	* configure.in: clean up, add checks for 64-bit support.
+
+	* lib/64.xlatetof.c: new file, based on lib/32.xlatetof.c.
+
+	* lib/Makefile.in: add target for 64.xlatetof.o.
+
+	* lib/cook.c: check for 32-bit overflow.
+
+	* lib/elf_repl.h:
+	* lib/ext_types.h: add 64-bit data types.
+
+	* lib/private.h: add 64-bit definitions.
+
+	* lib/sys_elf.h.in: add __LIBELF64* and __libelf_*_t.
+
+	* lib/update.c: add full 64-bit support.
+
+Mon Jun  1 16:29:07 MEST 1998, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* VERSION: change version to 0.7.0.
+
+	* configure.in:
+		add lib/sys_elf.h to AC_CONFIG_HEADER.
+		new option --disable-elf64.
+
+	* Makefile.in: add target for lib/sys_elf.h.
+
+	* acconfig.h: add __LIBELF_HEADER_ELF_H.
+
+	* lib/Makefile.in: add sys_elf.h(.in).
+
+	* lib/32.fsize.c:
+	* lib/32.getehdr.c:
+	* lib/32.getphdr.c:
+	* lib/32.getshdr.c:
+	* lib/32.newehdr.c:
+	* lib/32.newphdr.c:
+	* lib/cook.c:
+	* lib/getdata.c:
+	* lib/libelf.h:
+	* lib/newscn.c:
+	* lib/nlist.c:
+	* lib/opt.delscn.c:
+	* lib/private.h:
+	* lib/update.c:
+		merged with 64bit code.
+
+	* lib/begin.c:
+	* lib/input.c:
+		bug fixes.
+
+Fri Aug  1 19:33:33 MEST 1997, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* VERSION: change version to 0.6.5.
+	
+	* lib/libelf.h: add declaration for elf_memory.
+
+	* lib/private.h: add e_memory flag.
+	
+	* lib/begin.c: add elf_memory, change archive freezing logic.
+
+	* lib/end.c: do not free e_data if e_memory is set.
+
+Tue Oct 22 21:31:56 MEST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* (all files): add RCS Id, import to CVS.
+
+	* Makefile.in: pass $(CC) to config.status.
+
+	* README: change for upcoming 0.6.5 release.
+
+	* aclocal.m4 (mr_ENABLE_NLS): add --enable-gnu-names option
+
+	* configure.in: change search order for <elf.h>.
+
+	* lib/begin.c (_elf_arhdr): add check for truncated archive member.
+
+	* lib/cook.c (_elf32_cook): add checks for misaligned tables.
+
+	* lib/errors.h:
+		fix wrong error message (ERROR_WRONLY).
+		add error messages for misaligned tables.
+
+	* lib/private.h: add constants for table alignments.
+
+	* po/Makefile.in: do not run mkinstalldirs directly, use $(SHELL).
+
+	* po/libelf.pot: rebuild.
+
+Tue Jul 30 17:22:41 MET DST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* VERSION: change version to 0.6.4.
+
+	* Makefile.in:
+		add DISTSUBDIRS.
+		add po/Makefile target.
+
+	* po/Makefile.in:
+	* po/gmo2msg.c:
+	* po/libelf.pot:
+	* po/stamp-po:
+		new files.
+
+	* aclocal.m4 (mr_ENABLE_NLS):
+		add MSGFILES.
+		set GMOFILES, MSGFILES and POFILES even if NLS is disabled.
+
+	* configure.in:
+		add ALL_LINGUAS.
+
+	* lib/nlist.c:
+		call elf_errno() to clear pending error.
+
+Tue Jul 28 23:53:44 MET DST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* VERSION: change version to 0.6.3.
+
+	* configure.in: fix creation of sys_elf.h.
+
+	* lib/Makefile.in:
+		move elf_repl.h to PRIVHDRS.
+		do not depend on HDRS and AUXHDRS.
+
+Sat Jul 27 18:27:09 MET DST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* VERSION: change version to 0.6.2.
+
+	* Makefile.in:
+		remove support from SUBDIRS.
+		remove subdirs/Makefile target.
+
+	* acconfig.h:
+		add ENABLE_DEBUG.
+		remove HAVE_NLS.
+
+	* aclocal.m4:
+		add mr_ENABLE_DEBUG.
+
+	* configure.in:
+		use mr_ENABLE_DEBUG.
+
+	* lib/Makefile.in:
+		add LD variable.
+		add elf_repl.h to DISTFILES.
+
+	* lib/libelf.h:
+		add check for __LIBELF_INTERNAL__.
+
+	* lib/private.h:
+		#define __LIBELF_INTERNAL__.
+		use ENABLE_DEBUG.
+
+	* support/elf.h:
+		move to lib/elf_repl.h.
+
+	* support/Makefile.in:
+		remove.
+
+Sat Jul 27 06:25:23 MET DST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* VERSION: change version to 0.6.1.
+
+	* aclocal.m4: add shared library support for sparc-sun-solaris2.
+
+	* lib/libelf.h.in: remove.
+
+	* lib/libelf.h: new file.
+
+	* configure.in:
+		remove broken check for existing installation.
+		remove @install_headers@ and @elf_h@.
+		do not build libelf.h from libelf.h.in.
+		create lib/sys_elf.h.
+
+	* lib/Makefile.in:
+		remove libelf.h and $(AUXHDRS) targets.
+		remove libelf.h.in from DISTFILES.
+		add libelf.h to DISTFILES.
+		add dummy_shlib target for broken make.
+
+Sat Jul 27 01:01:45 MET DST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* VERSION: change version to 0.6.0.
+
+	* lib: new directory.
+
+	* config.sub:
+	* config.guess:
+		new files.
+
+	* shared:
+	* shared/Makefile.in:
+		remove.
+
+	* aclocal.m4:
+	* configure.in:
+		add shared library check.
+
+	* Makefile.in:
+	* lib/Makefile.in:
+		change for new directory structure.
+		integrate shared library support.
+
+	* Makefile.in:
+		remove libelf.lsm from DISTFILES.
+
+	* libelf.lsm: remove.
+
+Thu Jul 25 19:35:05 MET DST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* VERSION: change version to 0.5.9.
+
+	* aclocal.m4: rewrite NLS check.
+
+Tue Jul 23 18:59:05 MET DST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* Makefile.in: add install-compat and uninstall-compat targets.
+
+	* configure.in:
+	* aclocal.m4:
+		fix check for NLS support.
+
+	* acconfig.h: add HAVE_CATGETS and HAVE_GETTEXT.
+
+	* errmsg.c (elf_errmsg): use HAVE_GETTEXT.
+
+Sun Jul 21 22:52:02 MET DST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* VERSION: change version to 0.5.8.
+
+	* private.h:
+	* 32.getshdr.c:
+	* cook.c:
+	* end.c:
+	* newscn.c:
+	* opt.delscn.c:
+	* update.c:
+		change allocation of section headers.
+
+	* errors.h: fix speeling error.
+
+Sat Jul 13 22:51:16 MET DST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* VERSION: change version to 0.5.7.
+
+	* private.h: add e_dsize member to struct Elf.
+
+	* begin.c (elf_begin): set e_dsize.
+
+	* update.c (_elf32_update_pointers):
+		never let e_data become shorter than e_dsize bytes.
+		use correct base pointer.
+
+Sat Jun 15 16:28:50 MET DST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* 32.xlatetof.c: change `char' to `unsigned char'.
+
+Tue May 28 19:00:30 MET DST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* Makefile.in:
+		HP-UX make wants non-empty target, change it.
+		add targets for TAGS and libelf.po.
+
+	* errors.h: mark strings for GNU gettext.
+
+	* mkmsgs: recognize new errors.h format.
+
+	* errmsg.c (elf_errmsg): add gettext support.
+
+Mon May 27 20:30:30 MET DST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* VERSION: change version to 0.5.6.
+
+	* aclocal.m4:
+	* configure.in: use new AC_CACHE_CHECK macro.
+
+	* Makefile.in:
+	* shared/Makefile.in: use @...dir@.
+
+	* Makefile.in: pass $(SRCS) and $(OBJS) to shared/Makefile.
+
+Sat May 25 01:00:15 MET DST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* update.c (elf_update): assert e_data is malloc'ed.
+
+	* begin.c (elf_begin): mmap e_data if possible.
+
+	* end.c (elf_end): munmap e_data if necessary.
+
+	* input.c (_elf_mmap): new function.
+
+	* private.h: add _elf_mmap and e_unmap_data.
+
+	* errmsg.c: make pointer array constant.
+
+Thu May 23 19:24:47 MET DST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* update.c (elf_update): mmap(MAP_SHARED) wants non-empty file.
+
+Tue May 21 15:33:07 MET DST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* begin.c (elf_begin): re-read memory image of archive members.
+
+	* cook.c (_elf32_item):
+	* getdata.c (_elf32_cook_scn): always use memory image.
+
+	* update.c (_elf_update): use mmap if possible.
+
+	* configure.in: check for mmap.
+
+Mon May 20 18:15:54 MET DST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* nlist.c (_elf_nlist): fix broken st_name range check.
+
+	* update.c (_elf32_write): check status of elf_getdata.
+
+	* cook.c (_elf32_item):
+	* getdata.c (_elf32_cook_scn):
+		use memory image when file is not an archive member.
+
+	* rawdata.c (elf_rawdata): copy raw image rather than referencing it.
+
+Wed May 15 20:04:39 MET DST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* rawdata.c (elf_rawdata): use raw image if it is present.
+
+	* cntl.c (elf_cntl): fix archive handling, ignore ELF_C_FDREAD for non-ELF files.
+
+Fri May 10 17:16:44 MET DST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* begin.c (_elf_arhdr): fix handling of long archive member names.
+
+	* configure.in: move version information to external file.
+
+	* Makefile.in: add VERSION to DISTFILES.
+
+	* VERSION: new file.
+
+Sat May  4 20:56:43 MET DST 1996, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* configure.in: change version to 0.5.5.
+
+	* Makefile.in: add libelf.lsm and ChangeLog to DISTFILES.
+
+	* rawdata.c: reorder cases to avoid unnecessary malloc/free.
+
+	* all files: update copyright phrase.
+
+	* ChangeLog:
+	* libelf.lsm: new files.
+
+Sun Oct 29 19:34:00 MET 1995, Michael Riepe <michael@stud.uni-hannover.de>
+
+	* configure.in: change version to 0.5.3.
+
+	* Makefile.in:
+	* shared/Makefile.in: add opt.delscn.c.
+
+	* libelf.h.in: add declaration for elf_delscn.
+
+	* opt.delscn.c: new file.
+

+ 176 - 0
lib/libelf/INSTALL

@@ -0,0 +1,176 @@
+Basic Installation
+==================
+
+   These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+   The file `configure.in' is used to create `configure' by a program
+called `autoconf'.  You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  You can give `configure'
+initial values for variables by setting them in the environment.  Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory.  After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+   By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on.  Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+     CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+   If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+     Use and save the results of the tests in FILE instead of
+     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
+     debugging `configure'.
+
+`--help'
+     Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--version'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
+

+ 96 - 0
lib/libelf/MANIFEST

@@ -0,0 +1,96 @@
+25275 COPYING.LIB
+35406 ChangeLog
+7462 INSTALL
+5908 Makefile.in
+13232 README
+7 VERSION
+2955 acconfig.h
+9381 aclocal.m4
+43611 config.guess
+3987 config.h.in
+31160 config.sub
+110753 configure
+11736 configure.in
+2186 install-sh
+4798 lib/32.fsize.c
+1556 lib/32.getehdr.c
+1557 lib/32.getphdr.c
+1665 lib/32.getshdr.c
+2181 lib/32.newehdr.c
+3055 lib/32.newphdr.c
+12322 lib/32.xlatetof.c
+14221 lib/64.xlatetof.c
+8012 lib/Makefile.in
+4010 lib/Makefile.w32
+1119 lib/assert.c
+10463 lib/begin.c
+1685 lib/build.bat
+3566 lib/byteswap.h
+3937 lib/checksum.c
+1901 lib/cntl.c
+4851 lib/config.h.w32
+12554 lib/cook.c
+1183 lib/data.c
+24585 lib/elf_repl.h
+2899 lib/end.c
+2137 lib/errmsg.c
+1037 lib/errno.c
+6222 lib/errors.h
+8107 lib/ext_types.h
+997 lib/fill.c
+2400 lib/flag.c
+5103 lib/gelf.h
+4151 lib/gelfehdr.c
+3965 lib/gelfphdr.c
+3758 lib/gelfshdr.c
+9456 lib/gelftrans.c
+1175 lib/getarhdr.c
+1380 lib/getaroff.c
+2421 lib/getarsym.c
+1096 lib/getbase.c
+3841 lib/getdata.c
+1353 lib/getident.c
+1449 lib/getscn.c
+1212 lib/hash.c
+2562 lib/input.c
+1088 lib/kind.c
+1214 lib/libelf.def
+9050 lib/libelf.h
+1505 lib/memset.c
+1098 lib/ndxscn.c
+1558 lib/newdata.c
+3488 lib/newscn.c
+1356 lib/next.c
+1607 lib/nextscn.c
+5898 lib/nlist.c
+1452 lib/nlist.h
+5071 lib/opt.delscn.c
+13133 lib/private.h
+1286 lib/rand.c
+2543 lib/rawdata.c
+1541 lib/rawfile.c
+3393 lib/strptr.c
+2285 lib/swap64.c
+3812 lib/sys_elf.h.in
+4066 lib/sys_elf.h.w32
+26008 lib/update.c
+6884 lib/verdef.h
+1586 lib/verdef_32_tof.c
+1586 lib/verdef_32_tom.c
+1614 lib/verdef_64_tof.c
+1614 lib/verdef_64_tom.c
+7135 lib/verneed.h
+1435 lib/version.c
+4425 lib/x.elfext.c
+2721 lib/x.movscn.c
+2870 lib/x.remscn.c
+254 libelf.pc.in
+619 mkinstalldirs
+4593 po/Makefile.in
+8748 po/de.gmo
+52 po/de.msg
+11332 po/de.po
+3011 po/gmo2msg.c
+6483 po/libelf.pot
+10 po/stamp-po
+10 stamp-h.in

+ 198 - 0
lib/libelf/Makefile.in

@@ -0,0 +1,198 @@
+# Makefile for libelf.
+# Copyright (C) 1995 - 2005 Michael Riepe
+# 
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+# 
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Library General Public License for more details.
+# 
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+# @(#) $Id: Makefile.in,v 1.30 2008/05/23 08:17:56 michael Exp $
+
+instroot =
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+libdir = @libdir@
+
+pkgdir = $(libdir)/pkgconfig
+
+MV = mv -f
+RM = rm -f
+LN_S = @LN_S@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+
+CC = @CC@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+
+# no user serviceable parts below
+
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+
+SHELL = /bin/sh
+@SET_MAKE@
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+SUBDIRS = lib @POSUB@
+DISTSUBDIRS = lib po
+
+DISTFILES = \
+	acconfig.h aclocal.m4 ChangeLog config.guess config.h.in \
+	config.sub configure configure.in COPYING.LIB INSTALL install-sh \
+	Makefile.in mkinstalldirs README stamp-h.in VERSION libelf.pc.in
+
+all: all-recursive all-local
+check: check-recursive check-local
+install: install-recursive install-local
+uninstall: uninstall-recursive uninstall-local
+mostlyclean: mostlyclean-recursive mostlyclean-local
+clean: clean-recursive clean-local
+distclean: distclean-recursive distclean-local
+maintainer-clean: maintainer-clean-recursive maintainer-clean-local
+
+install-compat uninstall-compat:
+	cd lib && $(MAKE) $@
+
+all-recursive check-recursive install-recursive uninstall-recursive \
+clean-recursive distclean-recursive mostlyclean-recursive \
+maintainer-clean-recursive:
+	@subdirs="$(SUBDIRS)"; for subdir in $$subdirs; do \
+	  target=`echo $@|sed 's,-recursive,,'`; \
+	  echo making $$target in $$subdir; \
+	  (cd $$subdir && $(MAKE) $$target) || exit 1; \
+	done
+
+all-local:
+
+check-local:
+
+install-local: $(srcdir)/mkinstalldirs libelf.pc
+	$(SHELL) $(srcdir)/mkinstalldirs $(instroot)$(pkgdir)
+	$(INSTALL_DATA) libelf.pc $(instroot)$(pkgdir)
+
+uninstall-local:
+	$(RM) $(instroot)$(pkgdir)/libelf.pc
+
+mostlyclean-local:
+	$(RM) *~ core errlist
+
+clean-local: mostlyclean-local
+
+distclean-local: clean-local
+	$(RM) config.cache config.h config.log config.status stamp-h
+	$(RM) Makefile
+	$(RM) libelf.pc
+
+maintainer-clean-local: distclean-local
+	@echo "This command is intended for maintainers to use;"
+	@echo "it deletes files that may require special tools to rebuild."
+	$(RM) config.h.in configure stamp-dist
+	$(RM) -r $(distdir)
+
+# maintainer only
+
+MAINT = @MAINT@
+
+distdir = $(PACKAGE)-$(VERSION)
+DISTPERMS = --owner=root --group=root --numeric-owner
+$(MAINT)dist: ./stamp-dist
+$(MAINT)./stamp-dist: $(DISTFILES)
+	$(RM) -r $(distdir)
+	mkdir $(distdir)
+	files="$(DISTFILES)"; for file in $$files; do \
+	  ln $(srcdir)/$$file $(distdir) || \
+	    cp -p $(srcdir)/$$file $(distdir) || exit 1; \
+	done
+	subdirs="$(DISTSUBDIRS)"; for subdir in $$subdirs; do \
+	  (cd $$subdir && $(MAKE) dist) || exit 1; \
+	done
+	cd $(distdir) && \
+	    find . -type f ! -name MANIFEST -exec wc -c {} \; | \
+	    sed 's, \./, ,' | sort -k2 >MANIFEST
+	-$(RM) $(distdir).tar.gz.bak $(PACKAGE).tar.gz
+	-$(MV) $(distdir).tar.gz $(distdir).tar.gz.bak
+	tar cvohfz $(distdir).tar.gz $(DISTPERMS) $(distdir)
+	$(LN_S) $(distdir).tar.gz $(PACKAGE).tar.gz
+	$(RM) stamp-dist && echo timestamp > stamp-dist
+
+$(MAINT)check-dist:
+	$(RM) -r disttest
+	mkdir disttest
+	@echo 'unset CC CFLAGS CPPFLAGS LDFLAGS LIBS' >disttest/config.site
+	cd disttest && CONFIG_SITE=config.site ../$(distdir)/configure
+	$(MAKE) -C disttest
+	$(MAKE) -C disttest check
+	$(MAKE) -C disttest dist
+
+.PHONY: tags
+tags:
+	rm -f tags
+	ctags lib/*.c lib/*.h
+
+TRACKFS = trackfs
+trackinstall:
+	$(TRACKFS) -l install.log -b backup.cpio $(MAKE) install
+
+# For the justification of the following Makefile rules, see node
+# `Automatic Remaking' in GNU Autoconf documentation.
+
+$(MAINT)$(srcdir)/configure: $(srcdir)/configure.in $(srcdir)/aclocal.m4
+	$(RM) $(srcdir)/configure
+	cd $(srcdir) && autoconf
+
+$(MAINT)$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
+$(MAINT)$(srcdir)/stamp-h.in: $(srcdir)/configure.in $(srcdir)/acconfig.h
+	$(RM) $(srcdir)/config.h.in
+	cd $(srcdir) && autoheader
+	cd $(srcdir) && $(RM) stamp-h.in && echo timestamp > stamp-h.in
+
+$(MAINT)config.h: stamp-h
+$(MAINT)stamp-h: config.h.in config.status
+	CONFIG_FILES= CONFIG_HEADERS=config.h ./config.status
+	$(RM) stamp-h && echo timestamp > stamp-h
+
+$(MAINT)Makefile: Makefile.in config.status
+	CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
+
+$(MAINT)lib/Makefile: lib/Makefile.in config.status
+	CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
+
+$(MAINT)lib/sys_elf.h: lib/stamp-h
+$(MAINT)lib/stamp-h: lib/sys_elf.h.in config.status
+	CONFIG_FILES= CONFIG_HEADERS=lib/sys_elf.h ./config.status
+	$(RM) lib/stamp-h && echo timestamp > lib/stamp-h
+
+$(MAINT)po/Makefile: po/Makefile.in config.status
+	CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
+
+$(MAINT)libelf.pc: libelf.pc.in config.status
+	CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
+
+RECHECK_FLAGS = CC='$(CC)' CPPFLAGS='$(CPPFLAGS)' \
+	CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' LIBS='$(LIBS)'
+
+$(MAINT)config.status: configure config.h.in VERSION
+	$(RECHECK_FLAGS) ./config.status --recheck
+
+$(MAINT)reconfig:
+	$(RM) config.cache
+	$(RECHECK_FLAGS) ./config.status --recheck
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

+ 332 - 0
lib/libelf/README

@@ -0,0 +1,332 @@
+This is the public release of libelf-0.8.13, a free ELF object
+file access library. If you have problems with applications
+that use libelf and work with the commercial (SVR4, Solaris)
+version but not with this one, please contact me.
+
+IMPORTANT NOTE: If you have libelf-0.5.2 installed, you probably
+have a file .../include/elf.h that contains the single line
+``#include <libelf/elf.h>''. REMOVE THIS FILE BEFORE YOU RUN
+configure.
+
+Installation is straightforward - the package is autoconf'ed.  Just do
+``cd libelf-0.8.13; ./configure; make; make install''.  Header files
+will be installed in .../include/libelf/.  If your system does not
+provide its own versions of libelf.h, nlist.h or gelf.h, ``make
+install'' will add the missing headers.  If you prefer not to have
+these files installed in /usr/include, use ``--disable-compat'' and
+add ``-I /usr/include/libelf'' to your CFLAGS when compiling
+libelf-based programs.
+
+Note to distribution makers:  You can install libelf in a separate root
+hierarchy by using the command ``make instroot=/my/root install''.
+You should also use the ``--enable-compat'' configure option in that
+case, or run ``make instroot=/my/root install-compat'' manually, to
+install all the required header files.
+
+If you are running Linux with libc 5.* as the default C library,
+and you plan to use the 64-bit functions, you must either use
+``-I.../include/libelf'', or remove /usr/include/libelf.h and use
+``--enable-compat'' when running configure. Libc 6.* (aka glibc2)
+doesn't have its own <libelf.h>, <nlist.h> or <gelf.h>.
+
+You need an ANSI/ISO C compiler to build libelf. Gcc is optimal.
+
+On some systems (in particular, Solaris and all variants of Linux),
+``make'' will try to build a shared library. If you run into problems
+on your system, please pass ``--disable-shared'' to configure.
+If you build a shared library and want it to be installed as
+``libelf-0.8.13.so'' rather than ``libelf.so.0.8.13'', please use
+``./configure --enable-gnu-names''. Other files, e.g. ``libelf.so'' and
+``libelf.so.0'' are NOT affected.
+
+Another configure option, ``--enable-debug'', adds debugging code to
+libelf; if you don't run into problems, you will probably not need it.
+
+When creating an ELF shared library, it is possible to add references
+to other shared libraries in the DYNAMIC section of the resulting
+file. The make variable DEPSHLIBS contains a list of libraries to add.
+It is set to ``-lc'' on Linux systems, and empty otherwise. To
+override this setting, use something like ``make DEPSHLIBS="-la -lb"''.
+For Linux, `-lc' is included automagically.
+
+NLS is available and enabled by default.  To turn it off, pass the
+``--disable-nls'' option to configure.
+
+Libelf can use gettext or catgets for accessing message
+catalogs.  If gettext is available AND is part of libc (i.e. not
+in a separate library), it will be used. Otherwise, configure
+will look for catgets.  If you have gettext in a separate
+library and want to use it, you should pass the library's name
+to configure, e.g. ``LIBS=-lintl ./configure''. Note that you
+MUST link your libelf-based applications with -lintl then,
+which is probably not what you want, or change the DEPSHLIBS variable
+described above (in case you're building a shared library).
+
+If you have GNU gettext 0.10 installed on your system, and if GNU gettext
+runs on top of the catgets interface (rather old Linux systems, using
+libc5), configure will refuse to use it and use catgets instead. If you
+absolutely want to use GNU gettext, go ahead and rebuild it (which is
+IMHO a good idea in general in this case):
+
+	cd .../gettext-0.10
+	ac_cv_func_catgets=no ac_cv_func_gettext=no ./configure
+	make
+	make install
+
+After that, return to the libelf build directory, remove
+config.cache, and start over.
+
+*** Large File Support (LFS) applications ***
+
+Some 32-bit systems support files that are larger than the address space
+of the architecture.  On these, the `off_t' data type may have 32 or
+64 bits, depending on the API you choose.  Since off_t is also part of
+the libelf API, in particular the Elf_Data and Elf_Arhdr structures,
+an application compiled with large file support will need a version of
+libelf that has also been compiled with LFS; otherwise, it won't work
+correctly.  Similarly, a program compiled without LFS needs a library
+compiled without LFS.
+
+Note that libelf is currently unable to process large files on 32-bit
+architectures, whether you compile it for LFS or not, for the simple
+reason that the files won't fit into the processes' address space.
+Therefore, libelf is compiled without LFS by default.  It can of course
+read and write ELF files for 64-bit architectures, but they will be
+limited in length on a 32-bit system.
+
+You may compile libelf with large file support by setting CPPFLAGS at
+configuration time:
+
+	CPPFLAGS=`getconf LFS_CFLAGS` ./configure
+
+But I really, really recommend you don't, because it breaks binary
+compatibility with existing libelf based applications.
+
+*** 64-bit support ***
+
+Starting with libelf-0.7.0, libelf also supports 64-bit ELF files.
+This is enabled by default unless your system (or your compiler) does
+not support 64-bit integers, or lacks 64-bit declarations in <elf.h>.
+If you have problems building with 64-bit support, please do
+
+    ./configure --disable-elf64
+
+for the moment, and contact me. Please note that I haven't tested 64-bit
+support much.  There are still some unresolved problems, e.g. IRIX
+uses different Elf64_Rel and Elf64_Rela structures (they replaced the
+r_info member), and the enumeration values for Elf_Type differ from
+the commercial (SVR4) implementation of libelf - they broke binary
+compatibility for no good reason, and I'm not willing to follow their
+footsteps. The result is that libelf-0.7.* ist upward compatible with
+libelf-0.6.4 (as it should be) but INCOMPATIBLE WITH SVR4 LIBELF. If you
+have both versions installed, you'd better make sure that you link with
+the library that matches the <libelf.h> you're #include'ing.
+
+*** Symbol Versioning ***
+
+Libelf >= 0.8.0 supports the data structures and definitions used for
+symbol versioning on Solaris and Linux, in particular, the Elfxx_Verdef,
+Elfxx_Verdaux, Elfxx_Verneed, Elfxx_Vernaux and Elfxx_Versym structures
+and the SHT_XXX_verdef, SHT_XXX_verneed and SHT_XXX_versym section types
+(where `xx' is either `32' or `64', and `XXX' is either `SUNW' or `GNU').
+Libelf now translates versioning sections to/from their external
+representation properly (earlier versions left them in `raw' format,
+with the data type set to ELF_T_BYTE).  This may cause problems on
+systems which use the same (OS-specific) section types for different
+purposes.  The configure program tries to figure out if your OS uses
+versioning; if that check fails, you can use
+
+    ./configure --disable-versioning
+
+to turn off versioning translation support.
+
+*** W32 Support ***
+
+There is now some support for building on W32 systems (requires Microsoft
+VC++).  In order to build a W32 DLL, cd into the `lib' subdirectory, edit
+build.bat if necessary (it needs the path to your compiler binaries) and
+run it.  If you're lucky, libelf.dll and the import/export libraries will
+be built.  If not, please drop me a line.
+
+I tested it on XP Pro (SP2), using VC++ 2005 Express Edition.
+Apparently, Visual Studio .NET 2003 works fine as well.
+
+Various notes regarding the W32 port:
+
+    - When you open() an ELF file, remember to use the O_BINARY flag.
+    - You may have to add /MD to the linker command line.
+
+*** Missing things ***
+
+	* There is no documentation.  You can use the Solaris
+	  manpages instead (available at http://docs.sun.com/).
+	  The ELF file format is described in several places;
+	  among them Suns "Linker and Libraries Guide" and the
+	  "System V Application Binary Interface" documents;
+	  http://www.caldera.com/developer/devspecs/gabi41.pdf and
+	  http://www.caldera.com/developer/gabi/ are probably good
+	  starting points. Processor-specific documentation is spread
+	  across a number of `Processor Supplement' documents, one
+	  for each architecture; you'll have to use a search engine to
+	  find them.
+
+	* The COFF file format is not understood. This is so obsolete
+	  that it will probably never be implemented.
+
+	* nlist(3) is incomplete; the n_type and n_sclass
+	  members of struct nl are set to zero even if type
+	  (that is, debug) information is available.
+
+	* Libelf does not translate Solaris' `Move' and `Syminfo'
+	  sections. You can read them using elf_getdata(), but you'll
+	  only get raw (untranslated) bytes.
+
+Changes since 0.8.12:
+
+	* New function elf_getaroff().
+
+	* Build fixes.
+
+Changes since 0.8.11:
+
+	* Due to some unfortunate confusion, the elf_getphnum(),
+	  elf_getshnum() and elf_getshstrndx() are not compatible
+	  between libelf implementations. Therefore, the developers
+	  decided to replace them with new functions: elf_getphdrnum(),
+	  elf_getshdrnum() and elf_getshdrstrndx(), which will always
+	  return -1 on failure and 0 on success. Code using the old
+	  interface should be upgraded to increase portability.
+
+Changes since 0.8.10:
+
+	* Fixed a bug in elf_rawfile().
+	* If you use ELF_F_LAYOUT together with ELF_F_LAYOUT_OVERLAP,
+	  elf_update() will now tolerate overlapping sections.
+
+Changes since 0.8.9:
+
+	* Ported to QNX Neutrino.
+	* Fixed Windows build errors.
+	* Parallel (make -j) installation should work now.
+
+	* It's now possible to enable and disable select sanity checks
+	  libelf performs. Currently, this affects the "NUL terminated
+	  string table entry" check performed in elf_strptr(). By
+	  default, the function will return an error if the string
+	  requested is not properly terminated - because some
+	  applications might dump core otherwise. If you configure
+	  libelf with `--disable-sanity-checks', however, the check
+	  (and, in the future, probably others as well) is disabled
+	  by default. You can still turn it on and off at runtime by
+	  setting the LIBELF_SANITY_CHECKS environment variable to
+	  an integer value:
+
+	      # disable all sanity checks
+	      export LIBELF_SANITY_CHECKS=0
+
+	      # enable all sanity checks
+	      export LIBELF_SANITY_CHECKS=-1
+
+	  Each bit of the value corresponds to a particular check,
+	  so you could use LIBELF_SANITY_CHECKS=1 to enable only
+	  the elf_strptr() check. You may also use a value in hex
+	  (0x...) or octal (0...) format.
+ 
+Changes since 0.8.8:
+
+	* Improved translator for symbol versioning sections.
+	* The W32 library is now built in the `lib' subdirectory.
+	* Windows DLLs should work now.
+
+Changes since 0.8.6:
+
+	* added elf_getphnum().
+	* added elf_getshnum().
+	* added elf_getshstrndx().
+	* added elfx_update_shstrndx().
+	* handle interrupted reads/writes more gracefully.
+	* added (partial) support for unusual e_[ps]hentsize values.
+	* fixed the bugs introduced in 0.8.7.
+
+Changes since 0.8.5:
+
+	* added W32 support.
+	* added workaround for alignment errors in archive members.
+	* my email address has changed again ;)
+
+Changes since 0.8.4:
+
+	* elf_strptr() should now work more safely with fragmented
+	  or badly formatted string tables.
+
+Changes since 0.8.3:
+
+	* Fixed a bug in elf_update() that was introduced in 0.8.3.
+
+Changes since 0.8.2:
+
+	* Should compile on MacOSX now.
+
+	* Can read and write files with more than 65280 sections
+
+	* Tries to handle 64-bit ELF files that use 8-byte hash table
+	  entries. In particular, libelf tries to guess the data type in
+	  elf_getdata(), and doesn't override sh_entsize in elf_update()
+	  any longer. If you want the library to pick the entry size,
+	  you must set its value to 0 before you call elf_update().
+
+	* No longer dumps core in elf_update() when a versioning section
+	  has no data. Instead, it returns an error message. Note that
+	  you're supposed to provide a valid d_buf for any section, unless
+	  it's empty or has SHT_NOBITS type.
+
+	* Building a shared library is now the default (if supported).
+
+Changes since 0.8.0:
+
+	* Corrected typo in lib/{32,64}.xlatetof.c that sometimes
+	  caused a compilation failure.
+
+	* Use open(name, O_RDONLY|O_BINARY) in lib/nlist.c.
+
+Changes since 0.7.0:
+
+	* I implemented the gelf_* interface, as found on Solaris.
+	  I don't know whether it's compatible -- the Solaris manpage
+	  isn't very specific, so I had to guess return values etc. in
+	  some cases.
+
+	* Added elf{32,64}_checksum (supposed to be compatible with
+	  Solaris).
+
+	* Added symbol versioning support.
+
+Changes since 0.6.4:
+
+	* Fixed configure for IRIX systems
+	* Added check for truncated archive members
+	* Added check for misaligned SHDR/PHDR tables
+	* Support for building libelf together with GNU libc
+	* Added elf_memory(3)
+	* Added 64-bit support
+
+Changes since 0.5.2:
+
+	* some bug fixes
+	* mmap support
+	* new directory layout
+	* There is a new function, elf_delscn(), that deletes
+	  a section from an ELF file. It also adjusts the
+	  sh_link and sh_info members in the section header
+	  table, if (and ONLY if) the ELF standard indicates
+	  that these values are section indices. References
+	  to the deleted section will be cleared, so be careful.
+	* my email address has changed ;)
+
+Where to get libelf:
+
+	ftp://ftp.ibiblio.org/pub/Linux/libs/
+	http://www.mr511.de/software/
+
+Michael "Tired" Riepe
+<libelf@mr511.de>

+ 1 - 0
lib/libelf/VERSION

@@ -0,0 +1 @@
+0.8.13

+ 89 - 0
lib/libelf/acconfig.h

@@ -0,0 +1,89 @@
+/*
+ * acconfig.h - Special definitions for libelf, processed by autoheader.
+ * Copyright (C) 1995 - 2001, 2004, 2006 Michael Riepe
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+/* @(#) $Id: acconfig.h,v 1.16 2008/05/23 08:17:56 michael Exp $ */
+
+/* Define if you want to include extra debugging code */
+#undef ENABLE_DEBUG
+
+/* Define if you want to support extended ELF formats */
+#undef ENABLE_EXTENDED_FORMAT
+
+/* Define if you want ELF format sanity checks by default */
+#undef ENABLE_SANITY_CHECKS
+
+/* Define if memmove() does not copy overlapping arrays correctly */
+#undef HAVE_BROKEN_MEMMOVE
+
+/* Define if you have the catgets function. */
+#undef HAVE_CATGETS
+
+/* Define if you have the dgettext function. */
+#undef HAVE_DGETTEXT
+
+/* Define if you have the memset function.  */
+#undef HAVE_MEMSET
+
+/* Define if struct nlist is declared in <elf.h> or <sys/elf.h> */
+#undef HAVE_STRUCT_NLIST_DECLARATION
+
+/* Define if Elf32_Dyn is declared in <link.h> */
+#undef __LIBELF_NEED_LINK_H
+
+/* Define if Elf32_Dyn is declared in <sys/link.h> */
+#undef __LIBELF_NEED_SYS_LINK_H
+
+/* Define to `<elf.h>' or `<sys/elf.h>' if one of them is present */
+#undef __LIBELF_HEADER_ELF_H
+
+/* Define if you want 64-bit support (and your system supports it) */
+#undef __LIBELF64
+
+/* Define if you want 64-bit support, and are running IRIX */
+#undef __LIBELF64_IRIX
+
+/* Define if you want 64-bit support, and are running Linux */
+#undef __LIBELF64_LINUX
+
+/* Define if you want symbol versioning (and your system supports it) */
+#undef __LIBELF_SYMBOL_VERSIONS
+
+/* Define if symbol versioning uses Sun section type (SHT_SUNW_*) */
+#undef __LIBELF_SUN_SYMBOL_VERSIONS
+
+/* Define if symbol versioning uses GNU section types (SHT_GNU_*) */
+#undef __LIBELF_GNU_SYMBOL_VERSIONS
+
+/* Define to a 64-bit signed integer type if one exists */
+#undef __libelf_i64_t
+
+/* Define to a 64-bit unsigned integer type if one exists */
+#undef __libelf_u64_t
+
+/* Define to a 32-bit signed integer type if one exists */
+#undef __libelf_i32_t
+
+/* Define to a 32-bit unsigned integer type if one exists */
+#undef __libelf_u32_t
+
+/* Define to a 16-bit signed integer type if one exists */
+#undef __libelf_i16_t
+
+/* Define to a 16-bit unsigned integer type if one exists */
+#undef __libelf_u16_t

+ 336 - 0
lib/libelf/aclocal.m4

@@ -0,0 +1,336 @@
+# aclocal.m4 - Local additions to Autoconf macros.
+# Copyright (C) 1995 - 2006 Michael Riepe
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+# @(#) $Id: aclocal.m4,v 1.28 2008/05/23 08:17:56 michael Exp $
+
+AC_PREREQ(2.13)
+
+dnl mr_PACKAGE(package-name)
+AC_DEFUN(mr_PACKAGE, [changequote(<<, >>)dnl
+  changequote([, ])dnl
+  PACKAGE=$1
+  VERSION=`cat $srcdir/VERSION`
+  AC_SUBST(PACKAGE)
+  AC_SUBST(VERSION)
+  AC_ARG_ENABLE(maintainer-mode,
+    [  --enable-maintainer-mode
+                          enable maintainer-specific make rules (default: auto)],
+    [mr_enable_maintainer_mode="$enableval"],
+    [case :${I_AM_THE_MAINTAINER_OF}: in
+      *:$1:*) mr_enable_maintainer_mode=yes;;
+      *) mr_enable_maintainer_mode=no;;
+    esac])
+  if test x"$mr_enable_maintainer_mode" = x"yes"; then
+    MAINT=
+  else
+    MAINT='maintainer-only-'
+  fi
+  AC_SUBST(MAINT)
+])
+
+AC_DEFUN(mr_ENABLE_NLS, [
+  AC_PROVIDE([$0])
+
+  # Needed for `make dist' even if NLS is disabled.
+  GMOFILES=
+  MSGFILES=
+  POFILES=
+  for mr_lang in $ALL_LINGUAS; do
+    GMOFILES="$GMOFILES $mr_lang.gmo"
+    MSGFILES="$MSGFILES $mr_lang.msg"
+    POFILES="$POFILES $mr_lang.po"
+  done
+  AC_SUBST(GMOFILES)
+  AC_SUBST(MSGFILES)
+  AC_SUBST(POFILES)
+
+  AC_MSG_CHECKING([whether NLS is requested])
+  AC_ARG_ENABLE(nls,
+    [  --enable-nls            use Native Language Support (default: yes)],
+    [mr_enable_nls="$enableval"],
+    [mr_enable_nls=yes])
+  AC_MSG_RESULT($mr_enable_nls)
+
+  CATOBJEXT=
+  INSTOBJEXT=
+  localedir=
+  if test "$mr_enable_nls" = yes; then
+    mr_PATH=`echo ":$PATH" | sed -e 's,:[^:]*openwin[^:]*,,g' -e 's,^:,,'`
+    AC_CACHE_CHECK([for dgettext],
+      mr_cv_func_dgettext, [
+	AC_TRY_LINK([#include <libintl.h>],
+	  [char *s = dgettext("", ""); return 0],
+	  [mr_cv_func_dgettext=yes],
+	  [mr_cv_func_dgettext=no])
+    ])
+    if test "$mr_cv_func_dgettext" = yes; then
+      AC_PATH_PROG(MSGFMT, msgfmt, no, $mr_PATH)
+      if test "$MSGFMT" != no; then
+	AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT, $mr_PATH)
+	AC_PATH_PROG(XGETTEXT, xgettext, xgettext, $mr_PATH)
+	AC_PATH_PROG(MSGMERGE, msgmerge, msgmerge, $mr_PATH)
+	AC_CACHE_CHECK([for GNU gettext],
+	  mr_cv_gnu_gettext, [
+	    AC_TRY_LINK([],
+	      [extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr],
+	      [mr_cv_gnu_gettext=yes],
+	      [mr_cv_gnu_gettext=no])
+	])
+	if test "$mr_cv_gnu_gettext" = yes; then
+	  AC_CACHE_CHECK([for losing catgets-based GNU gettext],
+	    mr_cv_catgets_based_gettext, [
+	      AC_TRY_LINK([],
+		[extern int _msg_tbl_length; return _msg_tbl_length],
+		[mr_cv_catgets_based_gettext=yes],
+		[mr_cv_catgets_based_gettext=no])
+	  ])
+	  if test "$mr_cv_catgets_based_gettext" = yes; then
+	    # This loses completely. Turn it off and use catgets.
+	    LIBS=`echo $LIBS | sed 's,-lintl,,g'`
+	    mr_cv_func_dgettext=no
+	  else
+	    # Is there a better test for this case?
+	    AC_CACHE_CHECK([for pure GNU gettext],
+	      mr_cv_pure_gnu_gettext, [
+		AC_TRY_LINK([],
+		  [extern int gettext(); return gettext()],
+		  [mr_cv_pure_gnu_gettext=yes],
+		  [mr_cv_pure_gnu_gettext=no])
+	    ])
+	    if test "$mr_cv_pure_gnu_gettext" = yes; then
+	      CATOBJEXT=.gmo
+	      localedir='$(prefix)/share/locale'
+	    else
+	      CATOBJEXT=.mo
+	      localedir='$(prefix)/lib/locale'
+	    fi
+	    INSTOBJEXT=.mo
+	  fi
+	else
+	  # System provided gettext
+	  CATOBJEXT=.mo
+	  INSTOBJEXT=.mo
+	  localedir='$(prefix)/lib/locale'
+	fi
+      else
+	# Gettext but no msgfmt. Try catgets.
+	mr_cv_func_dgettext=no
+      fi
+    fi
+    if test "$mr_cv_func_dgettext" = yes; then
+      AC_DEFINE(HAVE_DGETTEXT)
+    else
+      AC_CACHE_CHECK([for catgets], mr_cv_func_catgets, [
+	AC_TRY_LINK([#include <nl_types.h>],
+	  [catgets(catopen("",0),0,0,"");return 0;],
+	  [mr_cv_func_catgets=yes],
+	  [mr_cv_func_catgets=no])
+      ])
+      if test "$mr_cv_func_catgets" = yes; then
+	AC_PATH_PROG(GENCAT, gencat, no, $mr_PATH)
+	if test "$GENCAT" != no; then
+	  AC_DEFINE(HAVE_CATGETS)
+	  AC_PATH_PROG(GMSGFMT, [gmsgfmt msgfmt], msgfmt, $mr_PATH)
+	  AC_PATH_PROG(XGETTEXT, xgettext, xgettext, $mr_PATH)
+	  CATOBJEXT=.cat
+	  INSTOBJEXT=.cat
+	  localedir='$(prefix)/lib/locale'
+	fi
+      else
+	AC_MSG_WARN([no NLS support, disabled])
+	mr_enable_nls=no
+      fi
+    fi
+  fi
+  AC_SUBST(CATOBJEXT)
+  AC_SUBST(INSTOBJEXT)
+  AC_SUBST(localedir)
+
+  POSUB=
+  CATALOGS=
+  if test "$mr_enable_nls" = yes; then
+    AC_MSG_CHECKING([for catalogs to be installed])
+    mr_linguas=
+    for mr_lang in ${LINGUAS=$ALL_LINGUAS}; do
+      case " $ALL_LINGUAS " in
+	*" $mr_lang "*)
+	  mr_linguas="$mr_linguas$mr_lang "
+	  CATALOGS="$CATALOGS $mr_lang$CATOBJEXT"
+	  ;;
+      esac
+    done
+    AC_MSG_RESULT($mr_linguas)
+    POSUB=po
+  fi
+  AC_SUBST(CATALOGS)
+  AC_SUBST(POSUB)
+])
+
+AC_DEFUN(mr_TARGET_ELF, [
+  AC_PROVIDE([$0])
+  AC_CACHE_CHECK([for native ELF system],
+    mr_cv_target_elf,
+    [AC_TRY_RUN(changequote(<<, >>)dnl
+<<#include <stdio.h>
+int
+main(int argc, char **argv) {
+  char buf[BUFSIZ];
+  FILE *fp;
+  int n;
+
+  if ((fp = fopen(*argv, "r")) == NULL) {
+    exit(1);
+  }
+  n = fread(buf, 1, sizeof(buf), fp);
+  if (n >= 52
+   && buf[0] == '\177'
+   && buf[1] == 'E'
+   && buf[2] == 'L'
+   && buf[3] == 'F') {
+    exit(0);
+  }
+  exit(1);
+}>>, changequote([, ])dnl
+      mr_cv_target_elf=yes,
+      mr_cv_target_elf=no,
+      mr_cv_target_elf=no)])])
+
+AC_DEFUN(mr_ENABLE_SHARED, [
+  AC_PROVIDE([$0])
+  PICFLAGS=
+  SHLIB_SFX=
+  SHLINK_SFX=
+  SONAME_SFX=
+  LINK_SHLIB=
+  INSTALL_SHLIB=
+  DEPSHLIBS=
+  AC_MSG_CHECKING([whether to build a shared library])
+  AC_ARG_ENABLE(shared,
+    [  --enable-shared         build shared library (default: yes)],
+    [mr_enable_shared="$enableval"],
+    [mr_enable_shared=yes])
+  AC_MSG_RESULT($mr_enable_shared)
+  if test "$mr_enable_shared" = yes; then
+    AC_MSG_CHECKING([whether GNU naming conventions are requested])
+    AC_ARG_ENABLE(gnu-names,
+      [  --enable-gnu-names      use GNU library naming conventions (default: no)],
+      [mr_enable_gnu_names="$enableval"],
+      [mr_enable_gnu_names=no])
+    AC_MSG_RESULT($mr_enable_gnu_names)
+    AC_REQUIRE([AC_CANONICAL_HOST])
+    AC_REQUIRE([AC_PROG_CC])
+    AC_PATH_PROG(LD, ld, ld)
+    case "$host" in
+      *-linux*|*-gnu*)
+	if test "$GCC" = yes; then
+	  mr_TARGET_ELF
+	  if test "$mr_cv_target_elf" = yes; then
+	    PICFLAGS='-fPIC -DPIC'
+	    if test "$mr_enable_gnu_names" = yes
+	    then SHLIB_SFX='-$(VERSION).so'
+	    else SHLIB_SFX='.so.$(VERSION)'
+	    fi
+	    SHLINK_SFX='.so'
+	    SONAME_SFX='.so.$(MAJOR)'
+	    LINK_SHLIB='$(CC) -shared -Wl,-soname,$(SONAME)'
+	    INSTALL_SHLIB='$(INSTALL_PROGRAM)'
+	    DEPSHLIBS='-lc'
+	  else
+	    AC_MSG_WARN([shared libraries not supported for $host])
+	    mr_enable_shared=no
+	  fi
+	elif ${CC} -V 2>&1 | grep 'Intel(R) C++ Compiler' >/dev/null 2>&1; then
+	  AC_MSG_WARN([Use --disable-shared if $CC fails to build the shared library])
+	  PICFLAGS='-fPIC -DPIC'
+	  if test "$mr_enable_gnu_names" = yes
+	  then SHLIB_SFX='-$(VERSION).so'
+	  else SHLIB_SFX='.so.$(VERSION)'
+	  fi
+	  SHLINK_SFX='.so'
+	  SONAME_SFX='.so.$(MAJOR)'
+	  LINK_SHLIB='$(CC) -shared -Wl,-soname,$(SONAME)'
+	  INSTALL_SHLIB='$(INSTALL_PROGRAM)'
+	  DEPSHLIBS='-lc'
+	else
+	  AC_MSG_WARN([GNU CC required for building shared libraries])
+	  mr_enable_shared=no
+	fi
+	;;
+      i386-pc-nto-qnx*)
+	mr_TARGET_ELF
+	if test "$mr_cv_target_elf" = yes; then
+	  PICFLAGS='-fPIC -DPIC'
+	  if test "$mr_enable_gnu_names" = yes
+	  then SHLIB_SFX='-$(VERSION).so'
+	  else SHLIB_SFX='.so.$(VERSION)'
+	  fi
+	  SHLINK_SFX='.so'
+	  SONAME_SFX='.so.$(MAJOR)'
+	  LINK_SHLIB='$(CC) -shared -Wl,-soname,$(SONAME)'
+	  INSTALL_SHLIB='$(INSTALL_PROGRAM)'
+	  DEPSHLIBS='-lc'
+	else
+	  AC_MSG_WARN([shared libraries not supported for $host])
+	  mr_enable_shared=no
+	fi
+	;;
+      sparc-sun-solaris2*)
+	if test "$GCC" = yes; then
+	  PICFLAGS='-fPIC -DPIC'
+	else
+	  PICFLAGS='-K PIC -DPIC'
+	fi
+	if test "$mr_enable_gnu_names" = yes
+	then SHLIB_SFX='-$(MAJOR).so'
+	else SHLIB_SFX='.so.$(MAJOR)'
+	fi
+	SONAME_SFX='.so.$(MAJOR)'
+	SHLINK_SFX='.so'
+	LINK_SHLIB='$(LD) -G -z text -h $(SONAME)'
+	INSTALL_SHLIB='$(INSTALL_PROGRAM)'
+	;;
+      *)
+	AC_MSG_WARN([shared libraries not supported for $host])
+	mr_enable_shared=no
+	;;
+    esac
+  else
+    mr_enable_shared=no
+  fi
+  AC_SUBST(PICFLAGS)
+  AC_SUBST(SHLIB_SFX)
+  AC_SUBST(SHLINK_SFX)
+  AC_SUBST(SONAME_SFX)
+  AC_SUBST(LINK_SHLIB)
+  AC_SUBST(INSTALL_SHLIB)
+  AC_SUBST(DEPSHLIBS)
+  DO_SHLIB="$mr_enable_shared"
+  AC_SUBST(DO_SHLIB)
+])
+
+AC_DEFUN(mr_ENABLE_DEBUG, [
+  AC_PROVIDE([$0])
+  AC_ARG_ENABLE(debug,
+    [  --enable-debug          include extra debugging code (default: no)],
+    [mr_enable_debug="$enableval"],
+    [mr_enable_debug=no])
+  if test "$mr_enable_debug" = yes; then
+    AC_DEFINE(ENABLE_DEBUG)
+  fi
+])
+
+# vi: set ts=8 sw=2 :

+ 1459 - 0
lib/libelf/config.guess

@@ -0,0 +1,1459 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+timestamp='2004-06-11'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit 0 ;;
+    --version | -v )
+       echo "$version" ; exit 0 ;;
+    --help | --h* | -h )
+       echo "$usage"; exit 0 ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep __ELF__ >/dev/null
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit 0 ;;
+    amd64:OpenBSD:*:*)
+	echo x86_64-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    amiga:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    arc:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    cats:OpenBSD:*:*)
+	echo arm-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    hp300:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    luna88k:OpenBSD:*:*)
+    	echo m88k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mac68k:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    macppc:OpenBSD:*:*)
+	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvme68k:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvme88k:OpenBSD:*:*)
+	echo m88k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvmeppc:OpenBSD:*:*)
+	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    pmax:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    sgi:OpenBSD:*:*)
+	echo mipseb-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    sun3:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    wgrisc:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    *:OpenBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit 0 ;;
+    macppc:MirBSD:*:*)
+	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+	exit 0 ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit 0 ;;
+    alpha:OSF1:*:*)
+	case $UNAME_RELEASE in
+	*4.0)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		;;
+	*5.*)
+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit 0 ;;
+    Alpha*:OpenVMS:*:*)
+	echo alpha-hp-vms
+	exit 0 ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit 0 ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit 0 ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit 0;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit 0 ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit 0 ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit 0 ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+	exit 0 ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit 0;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit 0;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit 0 ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit 0 ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit 0 ;;
+    DRS?6000:UNIX_SV:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7 && exit 0 ;;
+	esac ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    i86pc:SunOS:5.*:*)
+	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit 0 ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit 0 ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit 0 ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit 0 ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit 0 ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit 0 ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit 0 ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit 0 ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit 0 ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit 0 ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit 0 ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit 0 ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit 0 ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit 0 ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit 0 ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit 0 ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c \
+	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+	  && exit 0
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit 0 ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit 0 ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit 0 ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit 0 ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit 0 ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit 0 ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit 0 ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit 0 ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+ 	exit 0 ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit 0 ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit 0 ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit 0 ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit 0 ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit 0 ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
+	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit 0 ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit 0 ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+		echo rs6000-ibm-aix3.2.5
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit 0 ;;
+    *:AIX:*:[45])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit 0 ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit 0 ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit 0 ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit 0 ;;                           # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit 0 ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit 0 ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit 0 ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit 0 ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    # avoid double evaluation of $set_cc_for_build
+	    test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit 0 ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit 0 ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+	echo unknown-hitachi-hiuxwe2
+	exit 0 ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit 0 ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit 0 ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit 0 ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit 0 ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit 0 ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit 0 ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit 0 ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit 0 ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit 0 ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit 0 ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit 0 ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit 0 ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    *:UNICOS/mp:*:*)
+	echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit 0 ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit 0 ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit 0 ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit 0 ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit 0 ;;
+    *:FreeBSD:*:*)
+	# Determine whether the default compiler uses glibc.
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#if __GLIBC__ >= 2
+	LIBC=gnu
+	#else
+	LIBC=
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+	# GNU/KFreeBSD systems have a "k" prefix to indicate we are using
+	# FreeBSD's kernel, but not the complete OS.
+	case ${LIBC} in gnu) kernel_only='k' ;; esac
+	echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
+	exit 0 ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit 0 ;;
+    i*:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit 0 ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit 0 ;;
+    x86:Interix*:[34]*)
+	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
+	exit 0 ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit 0 ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit 0 ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit 0 ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit 0 ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    *:GNU:*:*)
+	# the GNU system
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit 0 ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit 0 ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit 0 ;;
+    arm*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-gnu
+	exit 0 ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    mips:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips
+	#undef mipsel
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mipsel
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+	;;
+    mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips64
+	#undef mips64el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mips64el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips64
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+	;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit 0 ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit 0 ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit 0 ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit 0 ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit 0 ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit 0 ;;
+    sh64*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit 0 ;;
+    i*86:Linux:*:*)
+	# The BFD linker knows what the default object file format is, so
+	# first see if it will tell us. cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	# Set LC_ALL=C to ensure ld outputs messages in English.
+	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+			 | sed -ne '/supported targets:/!d
+				    s/[ 	][ 	]*/ /g
+				    s/.*supported targets: *//
+				    s/ .*//
+				    p'`
+        case "$ld_supported_targets" in
+	  elf32-i386)
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+		;;
+	  a.out-i386-linux)
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+		exit 0 ;;
+	  coff-i386)
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+		exit 0 ;;
+	  "")
+		# Either a pre-BFD a.out linker (linux-gnuoldld) or
+		# one that does not give us useful --help.
+		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+		exit 0 ;;
+	esac
+	# Determine whether the default compiler is a.out or elf
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#ifdef __ELF__
+	# ifdef __GLIBC__
+	#  if __GLIBC__ >= 2
+	LIBC=gnu
+	#  else
+	LIBC=gnulibc1
+	#  endif
+	# else
+	LIBC=gnulibc1
+	# endif
+	#else
+	#ifdef __INTEL_COMPILER
+	LIBC=gnu
+	#else
+	LIBC=gnuaout
+	#endif
+	#endif
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+	;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit 0 ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit 0 ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit 0 ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit 0 ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit 0 ;;
+	i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit 0 ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit 0 ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit 0 ;;
+    i*86:*:5:[78]*)
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit 0 ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit 0 ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+	echo i386-pc-msdosdjgpp
+        exit 0 ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit 0 ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit 0 ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit 0 ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit 0 ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit 0 ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit 0 ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && echo i486-ncr-sysv4 && exit 0 ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit 0 ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit 0 ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit 0 ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit 0 ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit 0 ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit 0 ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes@openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit 0 ;;
+    *:*:*:FTX*)
+	# From seanf@swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit 0 ;;
+    *:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo hppa1.1-stratus-vos
+	exit 0 ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit 0 ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit 0 ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+	        echo mips-nec-sysv${UNAME_RELEASE}
+	else
+	        echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+        exit 0 ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit 0 ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit 0 ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit 0 ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit 0 ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit 0 ;;
+    *:Darwin:*:*)
+	case `uname -p` in
+	    *86) UNAME_PROCESSOR=i686 ;;
+	    powerpc) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit 0 ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit 0 ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit 0 ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit 0 ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit 0 ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit 0 ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit 0 ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit 0 ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit 0 ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit 0 ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit 0 ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit 0 ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit 0 ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit 0 ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+	exit 0 ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+	  ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit 0 ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit 0 ;;
+    c34*)
+	echo c34-convex-bsd
+	exit 0 ;;
+    c38*)
+	echo c38-convex-bsd
+	exit 0 ;;
+    c4*)
+	echo c4-convex-bsd
+	exit 0 ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+    ftp://ftp.gnu.org/pub/gnu/config/
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:

+ 151 - 0
lib/libelf/config.h.in

@@ -0,0 +1,151 @@
+/* config.h.in.  Generated automatically from configure.in by autoheader.  */
+
+/* Define to empty if the keyword does not work.  */
+#undef const
+
+/* Define if you have a working `mmap' system call.  */
+#undef HAVE_MMAP
+
+/* Define to `long' if <sys/types.h> doesn't define.  */
+#undef off_t
+
+/* Define to `unsigned' if <sys/types.h> doesn't define.  */
+#undef size_t
+
+/* Define if you have the ANSI C header files.  */
+#undef STDC_HEADERS
+
+/* Define if you want to include extra debugging code */
+#undef ENABLE_DEBUG
+
+/* Define if you want to support extended ELF formats */
+#undef ENABLE_EXTENDED_FORMAT
+
+/* Define if you want ELF format sanity checks by default */
+#undef ENABLE_SANITY_CHECKS
+
+/* Define if memmove() does not copy overlapping arrays correctly */
+#undef HAVE_BROKEN_MEMMOVE
+
+/* Define if you have the catgets function. */
+#undef HAVE_CATGETS
+
+/* Define if you have the dgettext function. */
+#undef HAVE_DGETTEXT
+
+/* Define if you have the memset function.  */
+#undef HAVE_MEMSET
+
+/* Define if struct nlist is declared in <elf.h> or <sys/elf.h> */
+#undef HAVE_STRUCT_NLIST_DECLARATION
+
+/* Define if Elf32_Dyn is declared in <link.h> */
+#undef __LIBELF_NEED_LINK_H
+
+/* Define if Elf32_Dyn is declared in <sys/link.h> */
+#undef __LIBELF_NEED_SYS_LINK_H
+
+/* Define to `<elf.h>' or `<sys/elf.h>' if one of them is present */
+#undef __LIBELF_HEADER_ELF_H
+
+/* Define if you want 64-bit support (and your system supports it) */
+#undef __LIBELF64
+
+/* Define if you want 64-bit support, and are running IRIX */
+#undef __LIBELF64_IRIX
+
+/* Define if you want 64-bit support, and are running Linux */
+#undef __LIBELF64_LINUX
+
+/* Define if you want symbol versioning (and your system supports it) */
+#undef __LIBELF_SYMBOL_VERSIONS
+
+/* Define if symbol versioning uses Sun section type (SHT_SUNW_*) */
+#undef __LIBELF_SUN_SYMBOL_VERSIONS
+
+/* Define if symbol versioning uses GNU section types (SHT_GNU_*) */
+#undef __LIBELF_GNU_SYMBOL_VERSIONS
+
+/* Define to a 64-bit signed integer type if one exists */
+#undef __libelf_i64_t
+
+/* Define to a 64-bit unsigned integer type if one exists */
+#undef __libelf_u64_t
+
+/* Define to a 32-bit signed integer type if one exists */
+#undef __libelf_i32_t
+
+/* Define to a 32-bit unsigned integer type if one exists */
+#undef __libelf_u32_t
+
+/* Define to a 16-bit signed integer type if one exists */
+#undef __libelf_i16_t
+
+/* Define to a 16-bit unsigned integer type if one exists */
+#undef __libelf_u16_t
+
+/* The number of bytes in a __int64.  */
+#undef SIZEOF___INT64
+
+/* The number of bytes in a int.  */
+#undef SIZEOF_INT
+
+/* The number of bytes in a long.  */
+#undef SIZEOF_LONG
+
+/* The number of bytes in a long long.  */
+#undef SIZEOF_LONG_LONG
+
+/* The number of bytes in a short.  */
+#undef SIZEOF_SHORT
+
+/* Define if you have the ftruncate function.  */
+#undef HAVE_FTRUNCATE
+
+/* Define if you have the getpagesize function.  */
+#undef HAVE_GETPAGESIZE
+
+/* Define if you have the memcmp function.  */
+#undef HAVE_MEMCMP
+
+/* Define if you have the memcpy function.  */
+#undef HAVE_MEMCPY
+
+/* Define if you have the memmove function.  */
+#undef HAVE_MEMMOVE
+
+/* Define if you have the memset function.  */
+#undef HAVE_MEMSET
+
+/* Define if you have the <ar.h> header file.  */
+#undef HAVE_AR_H
+
+/* Define if you have the <elf.h> header file.  */
+#undef HAVE_ELF_H
+
+/* Define if you have the <fcntl.h> header file.  */
+#undef HAVE_FCNTL_H
+
+/* Define if you have the <gelf.h> header file.  */
+#undef HAVE_GELF_H
+
+/* Define if you have the <libelf.h> header file.  */
+#undef HAVE_LIBELF_H
+
+/* Define if you have the <link.h> header file.  */
+#undef HAVE_LINK_H
+
+/* Define if you have the <nlist.h> header file.  */
+#undef HAVE_NLIST_H
+
+/* Define if you have the <stdint.h> header file.  */
+#undef HAVE_STDINT_H
+
+/* Define if you have the <sys/elf.h> header file.  */
+#undef HAVE_SYS_ELF_H
+
+/* Define if you have the <sys/link.h> header file.  */
+#undef HAVE_SYS_LINK_H
+
+/* Define if you have the <unistd.h> header file.  */
+#undef HAVE_UNISTD_H

+ 1805 - 0
lib/libelf/config.sub

@@ -0,0 +1,1805 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright 1992-2014 Free Software Foundation, Inc.
+
+timestamp='2014-09-26'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
+
+
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright 1992-2014 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+  linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | \
+  kopensolaris*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  android-linux)
+    os=-linux-android
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis | -knuth | -cray | -microblaze*)
+		os=
+		basic_machine=$1
+		;;
+	-bluegene*)
+		os=-cnk
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+	-chorusrdb)
+		os=-chorusrdb
+		basic_machine=$1
+		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*178)
+		os=-lynxos178
+		;;
+	-lynx*5)
+		os=-lynxos5
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| aarch64 | aarch64_be \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| am33_2.0 \
+	| arc | arceb \
+	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+	| avr | avr32 \
+	| be32 | be64 \
+	| bfin \
+	| c4x | c8051 | clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| epiphany \
+	| fido | fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| hexagon \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k | iq2000 \
+	| k1om \
+	| le32 | le64 \
+	| lm32 \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64octeon | mips64octeonel \
+	| mips64orion | mips64orionel \
+	| mips64r5900 | mips64r5900el \
+	| mips64vr | mips64vrel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa32r6 | mipsisa32r6el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64r6 | mipsisa64r6el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipsr5900 | mipsr5900el \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| moxie \
+	| mt \
+	| msp430 \
+	| nds32 | nds32le | nds32be \
+	| nios | nios2 | nios2eb | nios2el \
+	| ns16k | ns32k \
+	| open8 | or1k | or1knd | or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle \
+	| pyramid \
+	| riscv32 | riscv64 \
+	| rl78 | rx \
+	| score \
+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu \
+	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+	| ubicom32 \
+	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+	| we32k \
+	| x86 | xc16x | xstormy16 | xtensa \
+	| z8k | z80)
+		basic_machine=$basic_machine-unknown
+		;;
+	c54x)
+		basic_machine=tic54x-unknown
+		;;
+	c55x)
+		basic_machine=tic55x-unknown
+		;;
+	c6x)
+		basic_machine=tic6x-unknown
+		;;
+	leon|leon[3-9])
+		basic_machine=sparc-$basic_machine
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
+
+	strongarm | thumb | xscale)
+		basic_machine=arm-unknown
+		;;
+	xgate)
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	xscaleeb)
+		basic_machine=armeb-unknown
+		;;
+
+	xscaleel)
+		basic_machine=armel-unknown
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| aarch64-* | aarch64_be-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* | avr32-* \
+	| be32-* | be64-* \
+	| bfin-* | bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* \
+	| c8051-* | clipper-* | craynv-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| hexagon-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* | iq2000-* \
+	| k1om-* \
+	| le32-* | le64-* \
+	| lm32-* \
+	| m32c-* | m32r-* | m32rle-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+	| microblaze-* | microblazeel-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64octeon-* | mips64octeonel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64r5900-* | mips64r5900el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa32r6-* | mipsisa32r6el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64r6-* | mipsisa64r6el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipsr5900-* | mipsr5900el-* \
+	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| mt-* \
+	| msp430-* \
+	| nds32-* | nds32le-* | nds32be-* \
+	| nios-* | nios2-* | nios2eb-* | nios2el-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| open8-* \
+	| or1k*-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+	| pyramid-* \
+	| rl78-* | romp-* | rs6000-* | rx-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+	| tahoe-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tile*-* \
+	| tron-* \
+	| ubicom32-* \
+	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+	| vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* \
+	| xstormy16-* | xtensa*-* \
+	| ymp-* \
+	| z8k-* | z80-*)
+		;;
+	# Recognize the basic CPU types without company name, with glob match.
+	xtensa*)
+		basic_machine=$basic_machine-unknown
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	abacus)
+		basic_machine=abacus-unknown
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aros)
+		basic_machine=i386-pc
+		os=-aros
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	blackfin)
+		basic_machine=bfin-unknown
+		os=-linux
+		;;
+	blackfin-*)
+		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	bluegene*)
+		basic_machine=powerpc-ibm
+		os=-cnk
+		;;
+	c54x-*)
+		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c55x-*)
+		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c6x-*)
+		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	cegcc)
+		basic_machine=arm-unknown
+		os=-cegcc
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
+		;;
+	cr16 | cr16-*)
+		basic_machine=cr16-unknown
+		os=-elf
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	dicos)
+		basic_machine=i686-pc
+		os=-dicos
+		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	leon-*|leon[3-9]-*)
+		basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
+		;;
+	m68knommu)
+		basic_machine=m68k-unknown
+		os=-linux
+		;;
+	m68knommu-*)
+		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	microblaze*)
+		basic_machine=microblaze-xilinx
+		;;
+	mingw64)
+		basic_machine=x86_64-pc
+		os=-mingw64
+		;;
+	mingw32)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	mingw32ce)
+		basic_machine=arm-unknown
+		os=-mingw32ce
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	moxiebox)
+		basic_machine=moxie-unknown
+		os=-moxiebox
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
+	msys)
+		basic_machine=i686-pc
+		os=-msys
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	nacl)
+		basic_machine=le32-unknown
+		os=-nacl
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	neo-tandem)
+		basic_machine=neo-tandem
+		;;
+	nse-tandem)
+		basic_machine=nse-tandem
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	openrisc | openrisc-*)
+		basic_machine=or32-unknown
+		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	parisc)
+		basic_machine=hppa-unknown
+		os=-linux
+		;;
+	parisc-*)
+		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2 | pentiumiii | pentium3)
+		basic_machine=i686-pc
+		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc | ppcbe)	basic_machine=powerpc-unknown
+		;;
+	ppc-* | ppcbe-*)
+		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rdos | rdos64)
+		basic_machine=x86_64-pc
+		os=-rdos
+		;;
+	rdos32)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sde)
+		basic_machine=mipsisa32-sde
+		os=-elf
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	strongarm-* | thumb-*)
+		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tile*)
+		basic_machine=$basic_machine-unknown
+		os=-linux-gnu
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	xscale-* | xscalee[bl]-*)
+		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	z80-*-coff)
+		basic_machine=z80-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+	# First match some system type aliases
+	# that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+	-auroraux)
+		os=-auroraux
+		;;
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+	      | -sym* | -kopensolaris* | -plan9* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* | -aros* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -bitrig* | -openbsd* | -solidbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* | -cegcc* \
+	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+	-os400*)
+		os=-os400
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+	-tpf*)
+		os=-tpf
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
+	-dicos*)
+		os=-dicos
+		;;
+	-nacl*)
+		;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+	score-*)
+		os=-elf
+		;;
+	spu-*)
+		os=-elf
+		;;
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+	c4x-* | tic4x-*)
+		os=-coff
+		;;
+	c8051-*)
+		os=-elf
+		;;
+	hexagon-*)
+		os=-elf
+		;;
+	tic54x-*)
+		os=-coff
+		;;
+	tic55x-*)
+		os=-coff
+		;;
+	tic6x-*)
+		os=-coff
+		;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+	mep-*)
+		os=-elf
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-haiku)
+		os=-haiku
+		;;
+	*-ibm)
+		os=-aix
+		;;
+	*-knuth)
+		os=-mmixware
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-cnk*|-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-os400*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:

+ 7264 - 0
lib/libelf/configure

@@ -0,0 +1,7264 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.69.
+#
+#
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+	expr "X$arg" : "X\\(.*\\)$as_nl";
+	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# Use a proper internal environment variable to ensure we don't fall
+  # into an infinite loop, continuously re-executing ourselves.
+  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+    _as_can_reexec=no; export _as_can_reexec;
+    # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+  fi
+  # We don't want this to propagate to other subprocesses.
+          { _as_can_reexec=; unset _as_can_reexec;}
+if test "x$CONFIG_SHELL" = x; then
+  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+"
+  as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+  exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
+  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+  if (eval "$as_required") 2>/dev/null; then :
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  as_found=:
+  case $as_dir in #(
+	 /*)
+	   for as_base in sh bash ksh sh5; do
+	     # Try only shells that exist, to save several forks.
+	     as_shell=$as_dir/$as_base
+	     if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+		    { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  CONFIG_SHELL=$as_shell as_have_required=yes
+		   if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  break 2
+fi
+fi
+	   done;;
+       esac
+  as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+	      { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+  CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+      if test "x$CONFIG_SHELL" != x; then :
+  export CONFIG_SHELL
+             # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
+fi
+
+    if test x$as_have_required = xno; then :
+  $as_echo "$0: This script requires a shell more modern than all"
+  $as_echo "$0: the shells that I found on your system."
+  if test x${ZSH_VERSION+set} = xset ; then
+    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+  else
+    $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+  fi
+  exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+  as_lineno_1=$LINENO as_lineno_1a=$LINENO
+  as_lineno_2=$LINENO as_lineno_2a=$LINENO
+  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+  # already done that, so ensure we don't try to do so again and fall
+  # in an infinite loop.  This has already happened in practice.
+  _as_can_reexec=no; export _as_can_reexec
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -pR'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -pR'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -pR'
+  fi
+else
+  as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+PACKAGE_URL=
+
+ac_unique_file="VERSION"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_header_list=
+ac_subst_vars='LTLIBOBJS
+DO_SHLIB
+DEPSHLIBS
+INSTALL_SHLIB
+LINK_SHLIB
+SONAME_SFX
+SHLINK_SFX
+SHLIB_SFX
+PICFLAGS
+LD
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+LIBINTL
+POSUB
+CATALOGS
+INSTOBJEXT
+CATOBJEXT
+GENCAT
+MSGMERGE
+XGETTEXT
+GMSGFMT
+MSGFMT
+POFILES
+MSGFILES
+GMOFILES
+LIBOBJS
+DO_COMPAT
+EGREP
+GREP
+LN_S
+RANLIB
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+CPP
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+SET_MAKE
+MAJOR
+MAINT
+VERSION
+PACKAGE
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_maintainer_mode
+enable_compat
+enable_elf64
+enable_versioning
+enable_nls
+enable_shared
+enable_gnu_names
+enable_extended_format
+enable_sanity_checks
+enable_debug
+'
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval $ac_prev=\$ac_option
+    ac_prev=
+    continue
+  fi
+
+  case $ac_option in
+  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *=)   ac_optarg= ;;
+  *)    ac_optarg=yes ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=*)
+    datadir=$ac_optarg ;;
+
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=no ;;
+
+  -docdir | --docdir | --docdi | --doc | --do)
+    ac_prev=docdir ;;
+  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+    docdir=$ac_optarg ;;
+
+  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+    ac_prev=dvidir ;;
+  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+    dvidir=$ac_optarg ;;
+
+  -enable-* | --enable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=\$ac_optarg ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+    ac_prev=htmldir ;;
+  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+  | --ht=*)
+    htmldir=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localedir | --localedir | --localedi | --localed | --locale)
+    ac_prev=localedir ;;
+  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+    localedir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst | --locals)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+    ac_prev=pdfdir ;;
+  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+    pdfdir=$ac_optarg ;;
+
+  -psdir | --psdir | --psdi | --psd | --ps)
+    ac_prev=psdir ;;
+  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+    psdir=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=\$ac_optarg ;;
+
+  -without-* | --without-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=no ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    case $ac_envvar in #(
+      '' | [0-9]* | *[!_$as_cr_alnum]* )
+      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+    esac
+    eval $ac_envvar=\$ac_optarg
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+  case $enable_option_checking in
+    no) ;;
+    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+  esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
+		datadir sysconfdir sharedstatedir localstatedir includedir \
+		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+		libdir localedir mandir
+do
+  eval ac_val=\$$ac_var
+  # Remove trailing slashes.
+  case $ac_val in
+    */ )
+      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+      eval $ac_var=\$ac_val;;
+  esac
+  # Be sure to have absolute directory names.
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+  esac
+  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+  as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then the parent directory.
+  ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_myself" : 'X\(//\)[^/]' \| \
+	 X"$as_myself" : 'X\(//\)$' \| \
+	 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r "$srcdir/$ac_unique_file"; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+	pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+  srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+  eval ac_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_env_${ac_var}_value=\$${ac_var}
+  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking ...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR            user executables [EPREFIX/bin]
+  --sbindir=DIR           system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR        program executables [EPREFIX/libexec]
+  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --libdir=DIR            object code libraries [EPREFIX/lib]
+  --includedir=DIR        C header files [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
+  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
+  --docdir=DIR            documentation root [DATAROOTDIR/doc/PACKAGE]
+  --htmldir=DIR           html documentation [DOCDIR]
+  --dvidir=DIR            dvi documentation [DOCDIR]
+  --pdfdir=DIR            pdf documentation [DOCDIR]
+  --psdir=DIR             ps documentation [DOCDIR]
+_ACEOF
+
+  cat <<\_ACEOF
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-option-checking  ignore unrecognized --enable/--with options
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-maintainer-mode
+                          enable maintainer-specific make rules (default: auto)
+  --enable-compat         install <libelf.h>, <nlist.h> and <gelf.h> (default: auto)
+  --enable-elf64          compile in 64-bit support (default: auto)
+  --enable-versioning     compile in versioning support (default: auto)
+  --enable-nls            use Native Language Support (default: yes)
+  --enable-shared         build shared library (default: yes)
+  --enable-gnu-names      use GNU library naming conventions (default: no)
+  --enable-extended-format    support extended file formats (default: no)
+  --enable-sanity-checks      enable sanity checks by default (default: yes)
+  --enable-debug          include extra debugging code (default: no)
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to the package provider.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d "$ac_dir" ||
+      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+      continue
+    ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+    cd "$ac_dir" || { ac_status=$?; continue; }
+    # Check for guested configure.
+    if test -f "$ac_srcdir/configure.gnu"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+    elif test -f "$ac_srcdir/configure"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure" --help=recursive
+    else
+      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi || ac_status=$?
+    cd "$ac_pwd" || { ac_status=$?; break; }
+  done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+  cat <<\_ACEOF
+configure
+generated by GNU Autoconf 2.69
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  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 ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if eval \${$3+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+	 return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+	    return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  eval "$3=yes"
+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
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_type
+
+# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
+# --------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_c_compute_int ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if test "$cross_compiling" = yes; then
+    # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid; break
+else
+  as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=$ac_mid; break
+else
+  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  ac_lo= ac_hi=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid
+else
+  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+  else
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (($2) < 0)
+    {
+      long int i = longval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%ld", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%lu", i);
+    }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+  ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
+
+  fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_compute_int
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 test -x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    $as_echo "PATH: $as_dir"
+  done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+    2)
+      as_fn_append ac_configure_args1 " '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      as_fn_append ac_configure_args " '$ac_arg'"
+      ;;
+    esac
+  done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+	"s/'\''/'\''\\\\'\'''\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
+
+    $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      $as_echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=\$$ac_var
+	case $ac_val in
+	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+	esac
+	$as_echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      $as_echo "$as_me: caught signal $ac_signal"
+    $as_echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+  # We do not want a PATH search for config.site.
+  case $CONFIG_SITE in #((
+    -*)  ac_site_file1=./$CONFIG_SITE;;
+    */*) ac_site_file1=$CONFIG_SITE;;
+    *)   ac_site_file1=./$CONFIG_SITE;;
+  esac
+elif test "x$prefix" != xNONE; then
+  ac_site_file1=$prefix/share/config.site
+  ac_site_file2=$prefix/etc/config.site
+else
+  ac_site_file1=$ac_default_prefix/share/config.site
+  ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+  test "x$ac_site_file" = xNONE && continue
+  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file" \
+      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special files
+  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
+  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+as_fn_append ac_header_list " stdlib.h"
+as_fn_append ac_header_list " unistd.h"
+as_fn_append ac_header_list " sys/param.h"
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+	# differences in whitespace do not lead to failure.
+	ac_old_val_w=`echo x $ac_old_val`
+	ac_new_val_w=`echo x $ac_new_val`
+	if test "$ac_old_val_w" != "$ac_new_val_w"; then
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	  ac_cache_corrupted=:
+	else
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+	  eval $ac_var=\$ac_old_val
+	fi
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
+$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
+$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ac_config_headers="$ac_config_headers config.h lib/sys_elf.h"
+
+
+
+
+    PACKAGE=libelf
+  VERSION=`cat $srcdir/VERSION`
+
+
+  # Check whether --enable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then :
+  enableval=$enable_maintainer_mode; mr_enable_maintainer_mode="$enableval"
+else
+  case :${I_AM_THE_MAINTAINER_OF}: in
+      *:libelf:*) mr_enable_maintainer_mode=yes;;
+      *) mr_enable_maintainer_mode=no;;
+    esac
+fi
+
+  if test x"$mr_enable_maintainer_mode" = x"yes"; then
+    MAINT=
+  else
+    MAINT='maintainer-only-'
+  fi
+
+
+
+ALL_LINGUAS=`cd $srcdir/po && echo *.po | sed 's/\.po//g'`
+
+set `echo $VERSION | sed 's/\./ /g'`
+MAJOR=${1-1}
+MINOR=${2-0}
+PATCH=${3-0}
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+	@echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  SET_MAKE=
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+	;;
+    [ab].out )
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
+    *.* )
+	if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	then :; else
+	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	fi
+	# We set ac_cv_exeext here because the later test for it is not
+	# safe: cross compilers may not add the suffix if given an `-o'
+	# argument, so we may need to know it at that point already.
+	# Even if this section looks crufty: it has the advantage of
+	# actually working.
+	break;;
+    * )
+	break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+  ac_file=''
+fi
+if test -z "$ac_file"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  break;;
+    * ) break;;
+  esac
+done
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+  { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+  if { ac_try='./conftest$ac_cv_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+else
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+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
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if ${ac_cv_prog_CPP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if ${ac_cv_path_install+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+  ./ | .// | /[cC]/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    rm -rf conftest.one conftest.two conftest.dir
+	    echo one > conftest.one
+	    echo two > conftest.two
+	    mkdir conftest.dir
+	    if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+	      test -s conftest.one && test -s conftest.two &&
+	      test -s conftest.dir/conftest.one &&
+	      test -s conftest.dir/conftest.two
+	    then
+	      ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	      break 3
+	    fi
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+
+  done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_RANLIB+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    RANLIB=$ac_ct_RANLIB
+  fi
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in unistd.h stdint.h fcntl.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+for ac_header in elf.h sys/elf.h link.h sys/link.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if ${CC} can compile elf.h" >&5
+$as_echo_n "checking if ${CC} can compile elf.h... " >&6; }
+if ${libelf_cv_elf_h_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#if HAVE_ELF_H
+    #include <elf.h>
+    #elif HAVE_SYS_ELF_H
+    #include <sys/elf.h>
+    #endif
+int
+main ()
+{
+Elf32_Ehdr dummy
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libelf_cv_elf_h_works=yes
+else
+  libelf_cv_elf_h_works=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libelf_cv_elf_h_works" >&5
+$as_echo "$libelf_cv_elf_h_works" >&6; }
+if test "$libelf_cv_elf_h_works" = no; then
+  ac_cv_header_elf_h=no
+  ac_cv_header_sys_elf_h=no
+fi
+if test "$ac_cv_header_elf_h" = yes; then
+  $as_echo "#define __LIBELF_HEADER_ELF_H <elf.h>" >>confdefs.h
+
+elif test "$ac_cv_header_sys_elf_h" = yes; then
+  $as_echo "#define __LIBELF_HEADER_ELF_H <sys/elf.h>" >>confdefs.h
+
+fi
+
+for ac_header in ar.h libelf.h nlist.h gelf.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install <libelf.h>, <nlist.h> and <gelf.h>" >&5
+$as_echo_n "checking whether to install <libelf.h>, <nlist.h> and <gelf.h>... " >&6; }
+# Check whether --enable-compat was given.
+if test "${enable_compat+set}" = set; then :
+  enableval=$enable_compat; DO_COMPAT="$enableval"
+else
+  if test "$ac_cv_header_libelf_h$ac_cv_header_nlist_h$ac_cv_header_gelf_h" = yesyesyes
+  then DO_COMPAT=no
+  else DO_COMPAT=yes
+  fi
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DO_COMPAT" >&5
+$as_echo "$DO_COMPAT" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
+$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
+if ${ac_cv_c_const+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+#ifndef __cplusplus
+  /* Ultrix mips cc rejects this sort of thing.  */
+  typedef int charset[2];
+  const charset cs = { 0, 0 };
+  /* SunOS 4.1.1 cc rejects this.  */
+  char const *const *pcpcc;
+  char **ppc;
+  /* NEC SVR4.0.2 mips cc rejects this.  */
+  struct point {int x, y;};
+  static struct point const zero = {0,0};
+  /* AIX XL C 1.02.0.0 rejects this.
+     It does not let you subtract one const X* pointer from another in
+     an arm of an if-expression whose if-part is not a constant
+     expression */
+  const char *g = "string";
+  pcpcc = &g + (g ? g-g : 0);
+  /* HPUX 7.0 cc rejects these. */
+  ++pcpcc;
+  ppc = (char**) pcpcc;
+  pcpcc = (char const *const *) ppc;
+  { /* SCO 3.2v4 cc rejects this sort of thing.  */
+    char tx;
+    char *t = &tx;
+    char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+    *t++ = 0;
+    if (s) return 0;
+  }
+  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+    int x[] = {25, 17};
+    const int *foo = &x[0];
+    ++foo;
+  }
+  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+    typedef const int *iptr;
+    iptr p = 0;
+    ++p;
+  }
+  { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
+       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+    struct s { int j; const int *ap[3]; } bx;
+    struct s *b = &bx; b->j = 5;
+  }
+  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+    const int foo = 10;
+    if (!foo) return 0;
+  }
+  return !cs[0] && !zero.x;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_const=yes
+else
+  ac_cv_c_const=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
+$as_echo "$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+$as_echo "#define const /**/" >>confdefs.h
+
+fi
+
+ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
+if test "x$ac_cv_type_off_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define off_t long int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5
+$as_echo_n "checking size of short... " >&6; }
+if ${ac_cv_sizeof_short+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_short" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (short)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_short=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5
+$as_echo "$ac_cv_sizeof_short" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_SHORT $ac_cv_sizeof_short
+_ACEOF
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5
+$as_echo_n "checking size of int... " >&6; }
+if ${ac_cv_sizeof_int+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_int" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (int)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_int=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5
+$as_echo "$ac_cv_sizeof_int" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+_ACEOF
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
+$as_echo_n "checking size of long... " >&6; }
+if ${ac_cv_sizeof_long+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_long" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (long)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_long=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
+$as_echo "$ac_cv_sizeof_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+_ACEOF
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
+$as_echo_n "checking size of long long... " >&6; }
+if ${ac_cv_sizeof_long_long+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_long_long" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (long long)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_long_long=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
+$as_echo "$ac_cv_sizeof_long_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+_ACEOF
+
+
+# Windows port
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of __int64" >&5
+$as_echo_n "checking size of __int64... " >&6; }
+if ${ac_cv_sizeof___int64+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (__int64))" "ac_cv_sizeof___int64"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type___int64" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (__int64)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof___int64=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof___int64" >&5
+$as_echo "$ac_cv_sizeof___int64" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF___INT64 $ac_cv_sizeof___int64
+_ACEOF
+
+
+
+if test "$ac_cv_header_elf_h" = yes \
+|| test "$ac_cv_header_sys_elf_h" = yes; then
+
+  # Slowaris declares Elf32_Dyn in <link.h>.
+  # QNX declares Elf32_Dyn in <sys/link.h>.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct Elf32_Dyn" >&5
+$as_echo_n "checking for struct Elf32_Dyn... " >&6; }
+if ${libelf_cv_struct_elf32_dyn+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include __LIBELF_HEADER_ELF_H
+int
+main ()
+{
+Elf32_Dyn x
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libelf_cv_struct_elf32_dyn=yes
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <link.h>
+int
+main ()
+{
+Elf32_Dyn x
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libelf_cv_struct_elf32_dyn=link.h
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/link.h>
+int
+main ()
+{
+Elf32_Dyn x
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libelf_cv_struct_elf32_dyn=sys/link.h
+else
+  libelf_cv_struct_elf32_dyn=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
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libelf_cv_struct_elf32_dyn" >&5
+$as_echo "$libelf_cv_struct_elf32_dyn" >&6; }
+  if test "$libelf_cv_struct_elf32_dyn" = link.h; then
+    $as_echo "#define __LIBELF_NEED_LINK_H 1" >>confdefs.h
+
+  elif test "$libelf_cv_struct_elf32_dyn" = sys/link.h; then
+    $as_echo "#define __LIBELF_NEED_SYS_LINK_H 1" >>confdefs.h
+
+  elif test "$libelf_cv_struct_elf32_dyn" = no; then
+    as_fn_error $? "no declaration for Elf32_Dyn" "$LINENO" 5
+  fi
+
+  # Linux declares struct nlist in <elf.h>.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct nlist in elf.h" >&5
+$as_echo_n "checking for struct nlist in elf.h... " >&6; }
+if ${libelf_cv_struct_nlist+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include __LIBELF_HEADER_ELF_H
+int
+main ()
+{
+struct nlist nl
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libelf_cv_struct_nlist=yes
+else
+  libelf_cv_struct_nlist=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libelf_cv_struct_nlist" >&5
+$as_echo "$libelf_cv_struct_nlist" >&6; }
+  if test "$libelf_cv_struct_nlist" = yes; then
+    $as_echo "#define HAVE_STRUCT_NLIST_DECLARATION 1" >>confdefs.h
+
+  fi
+
+  # Check for 64-bit data types.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct Elf64_Ehdr" >&5
+$as_echo_n "checking for struct Elf64_Ehdr... " >&6; }
+if ${libelf_cv_struct_elf64_ehdr+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include __LIBELF_HEADER_ELF_H
+int
+main ()
+{
+Elf64_Ehdr x
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libelf_cv_struct_elf64_ehdr=yes
+else
+  libelf_cv_struct_elf64_ehdr=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libelf_cv_struct_elf64_ehdr" >&5
+$as_echo "$libelf_cv_struct_elf64_ehdr" >&6; }
+
+  # Linux lacks typedefs for scalar ELF64_* types.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Elf64_Addr" >&5
+$as_echo_n "checking for Elf64_Addr... " >&6; }
+if ${libelf_cv_type_elf64_addr+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include __LIBELF_HEADER_ELF_H
+int
+main ()
+{
+Elf64_Addr x
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libelf_cv_type_elf64_addr=yes
+else
+  libelf_cv_type_elf64_addr=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libelf_cv_type_elf64_addr" >&5
+$as_echo "$libelf_cv_type_elf64_addr" >&6; }
+
+  # IRIX' struct Elf64_Rel is slightly different. Ugh.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct Elf64_Rel" >&5
+$as_echo_n "checking for struct Elf64_Rel... " >&6; }
+if ${libelf_cv_struct_elf64_rel+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include __LIBELF_HEADER_ELF_H
+int
+main ()
+{
+Elf64_Rel x; x.r_info = 1
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libelf_cv_struct_elf64_rel=yes
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include __LIBELF_HEADER_ELF_H
+int
+main ()
+{
+Elf64_Rel x; x.r_sym = 1
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libelf_cv_struct_elf64_rel=irix
+else
+  libelf_cv_struct_elf64_rel=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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libelf_cv_struct_elf64_rel" >&5
+$as_echo "$libelf_cv_struct_elf64_rel" >&6; }
+
+  case "$libelf_cv_struct_elf64_ehdr:\
+$libelf_cv_type_elf64_addr:\
+$libelf_cv_struct_elf64_rel" in
+    yes:yes:yes)
+      libelf_64bit=yes;;
+    yes:yes:irix)
+      $as_echo "#define __LIBELF64_IRIX 1" >>confdefs.h
+
+      libelf_64bit=yes;;
+    yes:no:yes)
+      $as_echo "#define __LIBELF64_LINUX 1" >>confdefs.h
+
+      libelf_64bit=yes;;
+    *)
+      libelf_64bit=no;;
+  esac
+
+  # Check for symbol versioning definitions
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Elf32_Verdef" >&5
+$as_echo_n "checking for Elf32_Verdef... " >&6; }
+if ${libelf_cv_verdef32+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include __LIBELF_HEADER_ELF_H
+      #if __LIBELF_NEED_LINK_H
+      #include <link.h>	/* Solaris wants this */
+      #endif
+int
+main ()
+{
+struct {
+	Elf32_Verdef vd;
+	Elf32_Verdaux vda;
+	Elf32_Verneed vn;
+	Elf32_Vernaux vna;
+      } x
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libelf_cv_verdef32=yes
+else
+  libelf_cv_verdef32=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libelf_cv_verdef32" >&5
+$as_echo "$libelf_cv_verdef32" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Elf64_Verdef" >&5
+$as_echo_n "checking for Elf64_Verdef... " >&6; }
+if ${libelf_cv_verdef64+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include __LIBELF_HEADER_ELF_H
+      #if __LIBELF_NEED_LINK_H
+      #include <link.h>	/* Solaris wants this */
+      #endif
+int
+main ()
+{
+struct {
+	Elf64_Verdef vd;
+	Elf64_Verdaux vda;
+	Elf64_Verneed vn;
+	Elf64_Vernaux vna;
+      } x
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libelf_cv_verdef64=yes
+else
+  libelf_cv_verdef64=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libelf_cv_verdef64" >&5
+$as_echo "$libelf_cv_verdef64" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SHT_SUNW_verdef" >&5
+$as_echo_n "checking for SHT_SUNW_verdef... " >&6; }
+if ${libelf_cv_sun_verdef+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include __LIBELF_HEADER_ELF_H
+int
+main ()
+{
+Elf32_Word x = SHT_SUNW_verdef + SHT_SUNW_verneed + SHT_SUNW_versym
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libelf_cv_sun_verdef=yes
+else
+  libelf_cv_sun_verdef=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libelf_cv_sun_verdef" >&5
+$as_echo "$libelf_cv_sun_verdef" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SHT_GNU_verdef" >&5
+$as_echo_n "checking for SHT_GNU_verdef... " >&6; }
+if ${libelf_cv_gnu_verdef+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include __LIBELF_HEADER_ELF_H
+int
+main ()
+{
+Elf32_Word x = SHT_GNU_verdef + SHT_GNU_verneed + SHT_GNU_versym
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libelf_cv_gnu_verdef=yes
+else
+  libelf_cv_gnu_verdef=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libelf_cv_gnu_verdef" >&5
+$as_echo "$libelf_cv_gnu_verdef" >&6; }
+else
+  # lib/elf_repl.h supports 64-bit
+  libelf_64bit=yes
+
+  # lib/elf_repl.h supports symbol versioning
+  libelf_cv_verdef32=yes
+  libelf_cv_verdef64=yes
+  libelf_cv_sun_verdef=yes
+  libelf_cv_gnu_verdef=yes
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit integer" >&5
+$as_echo_n "checking for 64-bit integer... " >&6; }
+if ${libelf_cv_int64+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  if test "$ac_cv_sizeof_long" = 8; then
+    libelf_cv_int64='long'
+  elif test "$ac_cv_sizeof___int64" = 8; then
+    libelf_cv_int64='__int64'
+  elif test "$ac_cv_sizeof_long_long" = 8; then
+    libelf_cv_int64='long long'
+  else
+    libelf_cv_int64=no
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libelf_cv_int64" >&5
+$as_echo "$libelf_cv_int64" >&6; }
+if test "$libelf_cv_int64" = no; then
+  libelf_64bit=no
+else
+  cat >>confdefs.h <<_ACEOF
+#define __libelf_i64_t $libelf_cv_int64
+_ACEOF
+
+  cat >>confdefs.h <<_ACEOF
+#define __libelf_u64_t unsigned $libelf_cv_int64
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for 32-bit integer" >&5
+$as_echo_n "checking for 32-bit integer... " >&6; }
+if ${libelf_cv_int32+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  if test "$ac_cv_sizeof_int" = 4; then
+    libelf_cv_int32='int'
+  elif test "$ac_cv_sizeof_long" = 4; then
+    libelf_cv_int32='long'
+  else
+    libelf_cv_int32=no
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libelf_cv_int32" >&5
+$as_echo "$libelf_cv_int32" >&6; }
+if test "$libelf_cv_int32" = no; then
+  as_fn_error $? "neither int nor long is 32-bit" "$LINENO" 5
+else
+  cat >>confdefs.h <<_ACEOF
+#define __libelf_i32_t $libelf_cv_int32
+_ACEOF
+
+  cat >>confdefs.h <<_ACEOF
+#define __libelf_u32_t unsigned $libelf_cv_int32
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for 16-bit integer" >&5
+$as_echo_n "checking for 16-bit integer... " >&6; }
+if ${libelf_cv_int16+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  if test "$ac_cv_sizeof_short" = 2; then
+    libelf_cv_int16='short'
+  elif test "$ac_cv_sizeof_int" = 2; then
+    libelf_cv_int16='int'
+  else
+    libelf_cv_int16=no
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libelf_cv_int16" >&5
+$as_echo "$libelf_cv_int16" >&6; }
+if test "$libelf_cv_int16" = no; then
+  as_fn_error $? "neither short nor int is 16-bit" "$LINENO" 5
+else
+  cat >>confdefs.h <<_ACEOF
+#define __libelf_i16_t $libelf_cv_int16
+_ACEOF
+
+  cat >>confdefs.h <<_ACEOF
+#define __libelf_u16_t unsigned $libelf_cv_int16
+_ACEOF
+
+fi
+
+
+
+
+  for ac_header in $ac_header_list
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+
+
+
+for ac_func in getpagesize
+do :
+  ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize"
+if test "x$ac_cv_func_getpagesize" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_GETPAGESIZE 1
+_ACEOF
+
+fi
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5
+$as_echo_n "checking for working mmap... " >&6; }
+if ${ac_cv_func_mmap_fixed_mapped+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_mmap_fixed_mapped=no
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+/* malloc might have been renamed as rpl_malloc. */
+#undef malloc
+
+/* Thanks to Mike Haertel and Jim Avera for this test.
+   Here is a matrix of mmap possibilities:
+	mmap private not fixed
+	mmap private fixed at somewhere currently unmapped
+	mmap private fixed at somewhere already mapped
+	mmap shared not fixed
+	mmap shared fixed at somewhere currently unmapped
+	mmap shared fixed at somewhere already mapped
+   For private mappings, we should verify that changes cannot be read()
+   back from the file, nor mmap's back from the file at a different
+   address.  (There have been systems where private was not correctly
+   implemented like the infamous i386 svr4.0, and systems where the
+   VM page cache was not coherent with the file system buffer cache
+   like early versions of FreeBSD and possibly contemporary NetBSD.)
+   For shared mappings, we should conversely verify that changes get
+   propagated back to all the places they're supposed to be.
+
+   Grep wants private fixed already mapped.
+   The main things grep needs to know about mmap are:
+   * does it exist and is it safe to write into the mmap'd area
+   * how to use it (BSD variants)  */
+
+#include <fcntl.h>
+#include <sys/mman.h>
+
+#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H
+char *malloc ();
+#endif
+
+/* This mess was copied from the GNU getpagesize.h.  */
+#ifndef HAVE_GETPAGESIZE
+# ifdef _SC_PAGESIZE
+#  define getpagesize() sysconf(_SC_PAGESIZE)
+# else /* no _SC_PAGESIZE */
+#  ifdef HAVE_SYS_PARAM_H
+#   include <sys/param.h>
+#   ifdef EXEC_PAGESIZE
+#    define getpagesize() EXEC_PAGESIZE
+#   else /* no EXEC_PAGESIZE */
+#    ifdef NBPG
+#     define getpagesize() NBPG * CLSIZE
+#     ifndef CLSIZE
+#      define CLSIZE 1
+#     endif /* no CLSIZE */
+#    else /* no NBPG */
+#     ifdef NBPC
+#      define getpagesize() NBPC
+#     else /* no NBPC */
+#      ifdef PAGESIZE
+#       define getpagesize() PAGESIZE
+#      endif /* PAGESIZE */
+#     endif /* no NBPC */
+#    endif /* no NBPG */
+#   endif /* no EXEC_PAGESIZE */
+#  else /* no HAVE_SYS_PARAM_H */
+#   define getpagesize() 8192	/* punt totally */
+#  endif /* no HAVE_SYS_PARAM_H */
+# endif /* no _SC_PAGESIZE */
+
+#endif /* no HAVE_GETPAGESIZE */
+
+int
+main ()
+{
+  char *data, *data2, *data3;
+  const char *cdata2;
+  int i, pagesize;
+  int fd, fd2;
+
+  pagesize = getpagesize ();
+
+  /* First, make a file with some known garbage in it. */
+  data = (char *) malloc (pagesize);
+  if (!data)
+    return 1;
+  for (i = 0; i < pagesize; ++i)
+    *(data + i) = rand ();
+  umask (0);
+  fd = creat ("conftest.mmap", 0600);
+  if (fd < 0)
+    return 2;
+  if (write (fd, data, pagesize) != pagesize)
+    return 3;
+  close (fd);
+
+  /* Next, check that the tail of a page is zero-filled.  File must have
+     non-zero length, otherwise we risk SIGBUS for entire page.  */
+  fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600);
+  if (fd2 < 0)
+    return 4;
+  cdata2 = "";
+  if (write (fd2, cdata2, 1) != 1)
+    return 5;
+  data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L);
+  if (data2 == MAP_FAILED)
+    return 6;
+  for (i = 0; i < pagesize; ++i)
+    if (*(data2 + i))
+      return 7;
+  close (fd2);
+  if (munmap (data2, pagesize))
+    return 8;
+
+  /* Next, try to mmap the file at a fixed address which already has
+     something else allocated at it.  If we can, also make sure that
+     we see the same garbage.  */
+  fd = open ("conftest.mmap", O_RDWR);
+  if (fd < 0)
+    return 9;
+  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
+		     MAP_PRIVATE | MAP_FIXED, fd, 0L))
+    return 10;
+  for (i = 0; i < pagesize; ++i)
+    if (*(data + i) != *(data2 + i))
+      return 11;
+
+  /* Finally, make sure that changes to the mapped area do not
+     percolate back to the file as seen by read().  (This is a bug on
+     some variants of i386 svr4.0.)  */
+  for (i = 0; i < pagesize; ++i)
+    *(data2 + i) = *(data2 + i) + 1;
+  data3 = (char *) malloc (pagesize);
+  if (!data3)
+    return 12;
+  if (read (fd, data3, pagesize) != pagesize)
+    return 13;
+  for (i = 0; i < pagesize; ++i)
+    if (*(data + i) != *(data3 + i))
+      return 14;
+  close (fd);
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_mmap_fixed_mapped=yes
+else
+  ac_cv_func_mmap_fixed_mapped=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5
+$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; }
+if test $ac_cv_func_mmap_fixed_mapped = yes; then
+
+$as_echo "#define HAVE_MMAP 1" >>confdefs.h
+
+fi
+rm -f conftest.mmap conftest.txt
+
+for ac_func in ftruncate memcmp memcpy memmove
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset"
+if test "x$ac_cv_func_memset" = xyes; then :
+  $as_echo "#define HAVE_MEMSET 1" >>confdefs.h
+
+else
+  case " $LIBOBJS " in
+  *" memset.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS memset.$ac_objext"
+ ;;
+esac
+
+fi
+
+
+if test "$ac_cv_func_memset" = yes; then
+  $as_echo "#define HAVE_MEMSET 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether overlapping arrays are copied correctly" >&5
+$as_echo_n "checking whether overlapping arrays are copied correctly... " >&6; }
+if ${libelf_cv_working_memmove+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  libelf_cv_working_memmove='maybe not'
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include "confdefs.h"
+#if HAVE_MEMMOVE
+extern void *memmove();
+#else
+extern void bcopy();
+#define memmove(d,s,n) bcopy((s),(d),(n))
+#endif
+extern int strcmp();
+main() {
+  char buf[] = "0123456789";
+  memmove(buf + 1, buf, 9);
+  if (strcmp(buf, "0012345678")) exit(1);
+  exit(0);
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+      libelf_cv_working_memmove=yes
+else
+  libelf_cv_working_memmove=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libelf_cv_working_memmove" >&5
+$as_echo "$libelf_cv_working_memmove" >&6; }
+if test "$libelf_cv_working_memmove" != yes; then
+  $as_echo "#define HAVE_BROKEN_MEMMOVE 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the coffee machine" >&5
+$as_echo_n "checking the coffee machine... " >&6; }
+if ${mr_cv_coffee_machine+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  mr_cv_coffee_machine='empty - operator may not work as expected'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_cv_coffee_machine" >&5
+$as_echo "$mr_cv_coffee_machine" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether 64-bit ELF support is sufficient" >&5
+$as_echo_n "checking whether 64-bit ELF support is sufficient... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libelf_64bit" >&5
+$as_echo "$libelf_64bit" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to include 64-bit support" >&5
+$as_echo_n "checking whether to include 64-bit support... " >&6; }
+if test "$libelf_64bit" = no; then
+  libelf_enable_64bit=no
+else
+  # Check whether --enable-elf64 was given.
+if test "${enable_elf64+set}" = set; then :
+  enableval=$enable_elf64; libelf_enable_64bit="$enableval"
+else
+  libelf_enable_64bit=yes
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libelf_enable_64bit" >&5
+$as_echo "$libelf_enable_64bit" >&6; }
+if test "$libelf_enable_64bit" = yes; then
+  $as_echo "#define __LIBELF64 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether versioning support is sufficient" >&5
+$as_echo_n "checking whether versioning support is sufficient... " >&6; }
+libelf_versioning=no
+case "$libelf_enable_64bit:$libelf_cv_verdef32:$libelf_cv_verdef64" in
+  no:yes:* | yes:yes:yes)
+    if test "$libelf_cv_sun_verdef" = yes; then
+      $as_echo "#define __LIBELF_SUN_SYMBOL_VERSIONS 1" >>confdefs.h
+
+      libelf_versioning=yes
+    elif test "$libelf_cv_gnu_verdef" = yes; then
+      $as_echo "#define __LIBELF_GNU_SYMBOL_VERSIONS 1" >>confdefs.h
+
+      libelf_versioning=yes
+    fi;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libelf_versioning" >&5
+$as_echo "$libelf_versioning" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to include versioning support" >&5
+$as_echo_n "checking whether to include versioning support... " >&6; }
+if test "$libelf_versioning" = no; then
+  libelf_enable_versioning=no
+else
+  # Check whether --enable-versioning was given.
+if test "${enable_versioning+set}" = set; then :
+  enableval=$enable_versioning; libelf_enable_versioning="$enableval"
+else
+  libelf_enable_versioning=yes
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libelf_enable_versioning" >&5
+$as_echo "$libelf_enable_versioning" >&6; }
+if test "$libelf_enable_versioning" = yes; then
+  $as_echo "#define __LIBELF_SYMBOL_VERSIONS 1" >>confdefs.h
+
+fi
+
+
+
+
+  # Needed for `make dist' even if NLS is disabled.
+  GMOFILES=
+  MSGFILES=
+  POFILES=
+  for mr_lang in $ALL_LINGUAS; do
+    GMOFILES="$GMOFILES $mr_lang.gmo"
+    MSGFILES="$MSGFILES $mr_lang.msg"
+    POFILES="$POFILES $mr_lang.po"
+  done
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5
+$as_echo_n "checking whether NLS is requested... " >&6; }
+  # Check whether --enable-nls was given.
+if test "${enable_nls+set}" = set; then :
+  enableval=$enable_nls; mr_enable_nls="$enableval"
+else
+  mr_enable_nls=yes
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_enable_nls" >&5
+$as_echo "$mr_enable_nls" >&6; }
+
+  CATOBJEXT=
+  INSTOBJEXT=
+  localedir=
+  if test "$mr_enable_nls" = yes; then
+    mr_PATH=`echo ":$PATH" | sed -e 's,:^:*openwin^:*,,g' -e 's,^:,,'`
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dgettext" >&5
+$as_echo_n "checking for dgettext... " >&6; }
+if ${mr_cv_func_dgettext+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <libintl.h>
+int
+main ()
+{
+char *s = dgettext("", ""); return 0
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  mr_cv_func_dgettext=yes
+else
+  mr_cv_func_dgettext=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_cv_func_dgettext" >&5
+$as_echo "$mr_cv_func_dgettext" >&6; }
+    if test "$mr_cv_func_dgettext" = yes; then
+      # Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_MSGFMT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MSGFMT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $mr_PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_MSGFMT="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no"
+  ;;
+esac
+fi
+MSGFMT=$ac_cv_path_MSGFMT
+if test -n "$MSGFMT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5
+$as_echo "$MSGFMT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+      if test "$MSGFMT" != no; then
+	# Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GMSGFMT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $GMSGFMT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $mr_PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
+  ;;
+esac
+fi
+GMSGFMT=$ac_cv_path_GMSGFMT
+if test -n "$GMSGFMT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5
+$as_echo "$GMSGFMT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+	# Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_XGETTEXT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $XGETTEXT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $mr_PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_XGETTEXT="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT="xgettext"
+  ;;
+esac
+fi
+XGETTEXT=$ac_cv_path_XGETTEXT
+if test -n "$XGETTEXT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5
+$as_echo "$XGETTEXT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+	# Extract the first word of "msgmerge", so it can be a program name with args.
+set dummy msgmerge; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_MSGMERGE+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MSGMERGE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $mr_PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_MSGMERGE="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE="msgmerge"
+  ;;
+esac
+fi
+MSGMERGE=$ac_cv_path_MSGMERGE
+if test -n "$MSGMERGE"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5
+$as_echo "$MSGMERGE" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext" >&5
+$as_echo_n "checking for GNU gettext... " >&6; }
+if ${mr_cv_gnu_gettext+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+	    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  mr_cv_gnu_gettext=yes
+else
+  mr_cv_gnu_gettext=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_cv_gnu_gettext" >&5
+$as_echo "$mr_cv_gnu_gettext" >&6; }
+	if test "$mr_cv_gnu_gettext" = yes; then
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for losing catgets-based GNU gettext" >&5
+$as_echo_n "checking for losing catgets-based GNU gettext... " >&6; }
+if ${mr_cv_catgets_based_gettext+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+	      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+extern int _msg_tbl_length; return _msg_tbl_length
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  mr_cv_catgets_based_gettext=yes
+else
+  mr_cv_catgets_based_gettext=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_cv_catgets_based_gettext" >&5
+$as_echo "$mr_cv_catgets_based_gettext" >&6; }
+	  if test "$mr_cv_catgets_based_gettext" = yes; then
+	    # This loses completely. Turn it off and use catgets.
+	    LIBS=`echo $LIBS | sed 's,-lintl,,g'`
+	    mr_cv_func_dgettext=no
+	  else
+	    # Is there a better test for this case?
+	    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pure GNU gettext" >&5
+$as_echo_n "checking for pure GNU gettext... " >&6; }
+if ${mr_cv_pure_gnu_gettext+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+extern int gettext(); return gettext()
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  mr_cv_pure_gnu_gettext=yes
+else
+  mr_cv_pure_gnu_gettext=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_cv_pure_gnu_gettext" >&5
+$as_echo "$mr_cv_pure_gnu_gettext" >&6; }
+	    if test "$mr_cv_pure_gnu_gettext" = yes; then
+	      CATOBJEXT=.gmo
+	      localedir='$(prefix)/share/locale'
+	    else
+	      CATOBJEXT=.mo
+	      localedir='$(prefix)/lib/locale'
+	    fi
+	    INSTOBJEXT=.mo
+	  fi
+	else
+	  # System provided gettext
+	  CATOBJEXT=.mo
+	  INSTOBJEXT=.mo
+	  localedir='$(prefix)/lib/locale'
+	fi
+      else
+	# Gettext but no msgfmt. Try catgets.
+	mr_cv_func_dgettext=no
+      fi
+    fi
+    if test "$mr_cv_func_dgettext" = yes; then
+      $as_echo "#define HAVE_DGETTEXT 1" >>confdefs.h
+
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for catgets" >&5
+$as_echo_n "checking for catgets... " >&6; }
+if ${mr_cv_func_catgets+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <nl_types.h>
+int
+main ()
+{
+catgets(catopen("",0),0,0,"");return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  mr_cv_func_catgets=yes
+else
+  mr_cv_func_catgets=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_cv_func_catgets" >&5
+$as_echo "$mr_cv_func_catgets" >&6; }
+      if test "$mr_cv_func_catgets" = yes; then
+	# Extract the first word of "gencat", so it can be a program name with args.
+set dummy gencat; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GENCAT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $GENCAT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GENCAT="$GENCAT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $mr_PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_GENCAT="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_GENCAT" && ac_cv_path_GENCAT="no"
+  ;;
+esac
+fi
+GENCAT=$ac_cv_path_GENCAT
+if test -n "$GENCAT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GENCAT" >&5
+$as_echo "$GENCAT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+	if test "$GENCAT" != no; then
+	  $as_echo "#define HAVE_CATGETS 1" >>confdefs.h
+
+	  # Extract the first word of "gmsgfmt msgfmt", so it can be a program name with args.
+set dummy gmsgfmt msgfmt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GMSGFMT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $GMSGFMT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $mr_PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="msgfmt"
+  ;;
+esac
+fi
+GMSGFMT=$ac_cv_path_GMSGFMT
+if test -n "$GMSGFMT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5
+$as_echo "$GMSGFMT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+	  # Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_XGETTEXT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $XGETTEXT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $mr_PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_XGETTEXT="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT="xgettext"
+  ;;
+esac
+fi
+XGETTEXT=$ac_cv_path_XGETTEXT
+if test -n "$XGETTEXT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5
+$as_echo "$XGETTEXT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+	  CATOBJEXT=.cat
+	  INSTOBJEXT=.cat
+	  localedir='$(prefix)/lib/locale'
+	fi
+      else
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no NLS support, disabled" >&5
+$as_echo "$as_me: WARNING: no NLS support, disabled" >&2;}
+	mr_enable_nls=no
+      fi
+    fi
+  fi
+
+
+
+
+  POSUB=
+  CATALOGS=
+  if test "$mr_enable_nls" = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for catalogs to be installed" >&5
+$as_echo_n "checking for catalogs to be installed... " >&6; }
+    mr_linguas=
+    for mr_lang in ${LINGUAS=$ALL_LINGUAS}; do
+      case " $ALL_LINGUAS " in
+	*" $mr_lang "*)
+	  mr_linguas="$mr_linguas$mr_lang "
+	  CATALOGS="$CATALOGS $mr_lang$CATOBJEXT"
+	  ;;
+      esac
+    done
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_linguas" >&5
+$as_echo "$mr_linguas" >&6; }
+    POSUB=po
+  fi
+
+
+
+LIBINTL=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gettext in -lintl" >&5
+$as_echo_n "checking for gettext in -lintl... " >&6; }
+if ${ac_cv_lib_intl_gettext+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lintl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char gettext ();
+int
+main ()
+{
+return gettext ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_intl_gettext=yes
+else
+  ac_cv_lib_intl_gettext=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_gettext" >&5
+$as_echo "$ac_cv_lib_intl_gettext" >&6; }
+if test "x$ac_cv_lib_intl_gettext" = xyes; then :
+  LIBINTL=-lintl
+fi
+
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+
+
+  PICFLAGS=
+  SHLIB_SFX=
+  SHLINK_SFX=
+  SONAME_SFX=
+  LINK_SHLIB=
+  INSTALL_SHLIB=
+  DEPSHLIBS=
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build a shared library" >&5
+$as_echo_n "checking whether to build a shared library... " >&6; }
+  # Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+  enableval=$enable_shared; mr_enable_shared="$enableval"
+else
+  mr_enable_shared=yes
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_enable_shared" >&5
+$as_echo "$mr_enable_shared" >&6; }
+  if test "$mr_enable_shared" = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GNU naming conventions are requested" >&5
+$as_echo_n "checking whether GNU naming conventions are requested... " >&6; }
+    # Check whether --enable-gnu-names was given.
+if test "${enable_gnu_names+set}" = set; then :
+  enableval=$enable_gnu_names; mr_enable_gnu_names="$enableval"
+else
+  mr_enable_gnu_names=no
+fi
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_enable_gnu_names" >&5
+$as_echo "$mr_enable_gnu_names" >&6; }
+
+
+    # Extract the first word of "ld", so it can be a program name with args.
+set dummy ld; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_LD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $LD in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_LD="$LD" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_LD="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_LD" && ac_cv_path_LD="ld"
+  ;;
+esac
+fi
+LD=$ac_cv_path_LD
+if test -n "$LD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    case "$host" in
+      *-linux*|*-gnu*)
+	if test "$GCC" = yes; then
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for native ELF system" >&5
+$as_echo_n "checking for native ELF system... " >&6; }
+if ${mr_cv_target_elf+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  mr_cv_target_elf=no
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main(int argc, char **argv) {
+  char buf[BUFSIZ];
+  FILE *fp;
+  int n;
+
+  if ((fp = fopen(*argv, "r")) == NULL) {
+    exit(1);
+  }
+  n = fread(buf, 1, sizeof(buf), fp);
+  if (n >= 52
+   && buf[0] == '\177'
+   && buf[1] == 'E'
+   && buf[2] == 'L'
+   && buf[3] == 'F') {
+    exit(0);
+  }
+  exit(1);
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+        mr_cv_target_elf=yes
+else
+  mr_cv_target_elf=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_cv_target_elf" >&5
+$as_echo "$mr_cv_target_elf" >&6; }
+	  if test "$mr_cv_target_elf" = yes; then
+	    PICFLAGS='-fPIC -DPIC'
+	    if test "$mr_enable_gnu_names" = yes
+	    then SHLIB_SFX='-$(VERSION).so'
+	    else SHLIB_SFX='.so.$(VERSION)'
+	    fi
+	    SHLINK_SFX='.so'
+	    SONAME_SFX='.so.$(MAJOR)'
+	    LINK_SHLIB='$(CC) -shared -Wl,-soname,$(SONAME)'
+	    INSTALL_SHLIB='$(INSTALL_PROGRAM)'
+	    DEPSHLIBS='-lc'
+	  else
+	    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: shared libraries not supported for $host" >&5
+$as_echo "$as_me: WARNING: shared libraries not supported for $host" >&2;}
+	    mr_enable_shared=no
+	  fi
+	elif ${CC} -V 2>&1 | grep 'Intel(R) C++ Compiler' >/dev/null 2>&1; then
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Use --disable-shared if $CC fails to build the shared library" >&5
+$as_echo "$as_me: WARNING: Use --disable-shared if $CC fails to build the shared library" >&2;}
+	  PICFLAGS='-fPIC -DPIC'
+	  if test "$mr_enable_gnu_names" = yes
+	  then SHLIB_SFX='-$(VERSION).so'
+	  else SHLIB_SFX='.so.$(VERSION)'
+	  fi
+	  SHLINK_SFX='.so'
+	  SONAME_SFX='.so.$(MAJOR)'
+	  LINK_SHLIB='$(CC) -shared -Wl,-soname,$(SONAME)'
+	  INSTALL_SHLIB='$(INSTALL_PROGRAM)'
+	  DEPSHLIBS='-lc'
+	else
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GNU CC required for building shared libraries" >&5
+$as_echo "$as_me: WARNING: GNU CC required for building shared libraries" >&2;}
+	  mr_enable_shared=no
+	fi
+	;;
+      i386-pc-nto-qnx*)
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for native ELF system" >&5
+$as_echo_n "checking for native ELF system... " >&6; }
+if ${mr_cv_target_elf+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  mr_cv_target_elf=no
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main(int argc, char **argv) {
+  char buf[BUFSIZ];
+  FILE *fp;
+  int n;
+
+  if ((fp = fopen(*argv, "r")) == NULL) {
+    exit(1);
+  }
+  n = fread(buf, 1, sizeof(buf), fp);
+  if (n >= 52
+   && buf[0] == '\177'
+   && buf[1] == 'E'
+   && buf[2] == 'L'
+   && buf[3] == 'F') {
+    exit(0);
+  }
+  exit(1);
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+        mr_cv_target_elf=yes
+else
+  mr_cv_target_elf=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_cv_target_elf" >&5
+$as_echo "$mr_cv_target_elf" >&6; }
+	if test "$mr_cv_target_elf" = yes; then
+	  PICFLAGS='-fPIC -DPIC'
+	  if test "$mr_enable_gnu_names" = yes
+	  then SHLIB_SFX='-$(VERSION).so'
+	  else SHLIB_SFX='.so.$(VERSION)'
+	  fi
+	  SHLINK_SFX='.so'
+	  SONAME_SFX='.so.$(MAJOR)'
+	  LINK_SHLIB='$(CC) -shared -Wl,-soname,$(SONAME)'
+	  INSTALL_SHLIB='$(INSTALL_PROGRAM)'
+	  DEPSHLIBS='-lc'
+	else
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: shared libraries not supported for $host" >&5
+$as_echo "$as_me: WARNING: shared libraries not supported for $host" >&2;}
+	  mr_enable_shared=no
+	fi
+	;;
+      sparc-sun-solaris2*)
+	if test "$GCC" = yes; then
+	  PICFLAGS='-fPIC -DPIC'
+	else
+	  PICFLAGS='-K PIC -DPIC'
+	fi
+	if test "$mr_enable_gnu_names" = yes
+	then SHLIB_SFX='-$(MAJOR).so'
+	else SHLIB_SFX='.so.$(MAJOR)'
+	fi
+	SONAME_SFX='.so.$(MAJOR)'
+	SHLINK_SFX='.so'
+	LINK_SHLIB='$(LD) -G -z text -h $(SONAME)'
+	INSTALL_SHLIB='$(INSTALL_PROGRAM)'
+	;;
+      *)
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: shared libraries not supported for $host" >&5
+$as_echo "$as_me: WARNING: shared libraries not supported for $host" >&2;}
+	mr_enable_shared=no
+	;;
+    esac
+  else
+    mr_enable_shared=no
+  fi
+
+
+
+
+
+
+
+  DO_SHLIB="$mr_enable_shared"
+
+
+
+# Check whether --enable-extended-format was given.
+if test "${enable_extended_format+set}" = set; then :
+  enableval=$enable_extended_format; mr_enable_extended_format="$enableval"
+else
+  mr_enable_extended_format=no
+fi
+
+if test "$mr_enable_extended_format" = yes; then
+  $as_echo "#define ENABLE_EXTENDED_FORMAT 1" >>confdefs.h
+
+fi
+
+# Check whether --enable-sanity-checks was given.
+if test "${enable_sanity_checks+set}" = set; then :
+  enableval=$enable_sanity_checks; mr_enable_sanity_checks="$enableval"
+else
+  mr_enable_sanity_checks=yes
+fi
+
+if test "$mr_enable_sanity_checks" = yes; then
+  $as_echo "#define ENABLE_SANITY_CHECKS 1" >>confdefs.h
+
+fi
+
+
+
+  # Check whether --enable-debug was given.
+if test "${enable_debug+set}" = set; then :
+  enableval=$enable_debug; mr_enable_debug="$enableval"
+else
+  mr_enable_debug=no
+fi
+
+  if test "$mr_enable_debug" = yes; then
+    $as_echo "#define ENABLE_DEBUG 1" >>confdefs.h
+
+  fi
+
+
+ac_config_files="$ac_config_files Makefile lib/Makefile po/Makefile libelf.pc"
+
+ac_config_commands="$ac_config_commands default"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+
+  (set) 2>&1 |
+    case $as_nl`(ac_space=' '; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      # `set' does not quote correctly, so add quotes: double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \.
+      sed -n \
+	"s/'/'\\\\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;; #(
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+) |
+  sed '
+     /^ac_cv_env_/b end
+     t clear
+     :clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+  if test -w "$cache_file"; then
+    if test "x$cache_file" != "x/dev/null"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+      if test ! -f "$cache_file" || test -h "$cache_file"; then
+	cat confcache >"$cache_file"
+      else
+        case $cache_file in #(
+        */* | ?:*)
+	  mv -f confcache "$cache_file"$$ &&
+	  mv -f "$cache_file"$$ "$cache_file" ;; #(
+        *)
+	  mv -f confcache "$cache_file" ;;
+	esac
+      fi
+    fi
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+  #    will be set to the directory where LIBOBJS objects are built.
+  as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+	expr "X$arg" : "X\\(.*\\)$as_nl";
+	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -pR'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -pR'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -pR'
+  fi
+else
+  as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration.  Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number and configuration settings, then exit
+      --config     print configuration, then exit
+  -q, --quiet, --silent
+                   do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+      --file=FILE[:TEMPLATE]
+                   instantiate the configuration file FILE
+      --header=FILE[:TEMPLATE]
+                   instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to the package provider."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.69,
+  with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=?*)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  --*=)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=
+    ac_shift=:
+    ;;
+  *)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    $as_echo "$ac_cs_version"; exit ;;
+  --config | --confi | --conf | --con | --co | --c )
+    $as_echo "$ac_cs_config"; exit ;;
+  --debug | --debu | --deb | --de | --d | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    '') as_fn_error $? "missing file argument" ;;
+    esac
+    as_fn_append CONFIG_FILES " '$ac_optarg'"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+    ac_need_defaults=false;;
+  --he | --h)
+    # Conflict between --help and --header
+    as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+  --help | --hel | -h )
+    $as_echo "$ac_cs_usage"; exit ;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+  *) as_fn_append ac_config_targets " $1"
+     ac_need_defaults=false ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  shift
+  \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+  CONFIG_SHELL='$SHELL'
+  export CONFIG_SHELL
+  exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+  case $ac_config_target in
+    "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+    "lib/sys_elf.h") CONFIG_HEADERS="$CONFIG_HEADERS lib/sys_elf.h" ;;
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
+    "po/Makefile") CONFIG_FILES="$CONFIG_FILES po/Makefile" ;;
+    "libelf.pc") CONFIG_FILES="$CONFIG_FILES libelf.pc" ;;
+    "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
+
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+  esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+  tmp= ac_tmp=
+  trap 'exit_status=$?
+  : "${ac_tmp:=$tmp}"
+  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+  trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+  test -d "$tmp"
+}  ||
+{
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+  eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+  ac_cs_awk_cr='\\r'
+else
+  ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+  echo "cat >conf$$subs.awk <<_ACEOF" &&
+  echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+  echo "_ACEOF"
+} >conf$$subs.sh ||
+  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  . ./conf$$subs.sh ||
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+  if test $ac_delim_n = $ac_delim_num; then
+    break
+  elif $ac_last_try; then
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+  N
+  s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+  for (key in S) S_is_set[key] = 1
+  FS = ""
+
+}
+{
+  line = $ 0
+  nfields = split(line, field, "@")
+  substed = 0
+  len = length(field[1])
+  for (i = 2; i < nfields; i++) {
+    key = field[i]
+    keylen = length(key)
+    if (S_is_set[key]) {
+      value = S[key]
+      line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+      len += length(value) + length(field[++i])
+      substed = 1
+    } else
+      len += 1 + keylen
+  }
+
+  print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+  sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+  cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=[	 ]*/{
+h
+s///
+s/^/:/
+s/[	 ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[	 ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[	 ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_tt"; then
+    break
+  elif $ac_last_try; then
+    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any.  Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[	 ]*#[	 ]*define[	 ][	 ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[	 ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[	 ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  for (key in D) D_is_set[key] = 1
+  FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+  line = \$ 0
+  split(line, arg, " ")
+  if (arg[1] == "#") {
+    defundef = arg[2]
+    mac1 = arg[3]
+  } else {
+    defundef = substr(arg[1], 2)
+    mac1 = arg[2]
+  }
+  split(mac1, mac2, "(") #)
+  macro = mac2[1]
+  prefix = substr(line, 1, index(line, defundef) - 1)
+  if (D_is_set[macro]) {
+    # Preserve the white space surrounding the "#".
+    print prefix "define", macro P[macro] D[macro]
+    next
+  } else {
+    # Replace #undef with comments.  This is necessary, for example,
+    # in the case of _POSIX_SOURCE, which is predefined and required
+    # on some systems where configure will not decide to define it.
+    if (defundef == "undef") {
+      print "/*", prefix defundef, macro, "*/"
+      next
+    }
+  }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X "  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+  case $ac_tag in
+  :[FHLC]) ac_mode=$ac_tag; continue;;
+  esac
+  case $ac_mode$ac_tag in
+  :[FHL]*:*);;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+  :[FH]-) ac_tag=-:-;;
+  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+  esac
+  ac_save_IFS=$IFS
+  IFS=:
+  set x $ac_tag
+  IFS=$ac_save_IFS
+  shift
+  ac_file=$1
+  shift
+
+  case $ac_mode in
+  :L) ac_source=$1;;
+  :[FH])
+    ac_file_inputs=
+    for ac_f
+    do
+      case $ac_f in
+      -) ac_f="$ac_tmp/stdin";;
+      *) # Look for the file first in the build tree, then in the source tree
+	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
+	 # because $ac_f cannot contain `:'.
+	 test -f "$ac_f" ||
+	   case $ac_f in
+	   [\\/$]*) false;;
+	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+	   esac ||
+	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+      esac
+      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+      as_fn_append ac_file_inputs " '$ac_f'"
+    done
+
+    # Let's still pretend it is `configure' which instantiates (i.e., don't
+    # use $as_me), people would be surprised to read:
+    #    /* config.h.  Generated by config.status.  */
+    configure_input='Generated from '`
+	  $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+	`' by configure.'
+    if test x"$ac_file" != x-; then
+      configure_input="$ac_file.  $configure_input"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+    fi
+    # Neutralize special characters interpreted by sed in replacement strings.
+    case $configure_input in #(
+    *\&* | *\|* | *\\* )
+       ac_sed_conf_input=`$as_echo "$configure_input" |
+       sed 's/[\\\\&|]/\\\\&/g'`;; #(
+    *) ac_sed_conf_input=$configure_input;;
+    esac
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$ac_tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+    esac
+    ;;
+  esac
+
+  ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  as_dir="$ac_dir"; as_fn_mkdir_p
+  ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+  case $ac_mode in
+  :F)
+  #
+  # CONFIG_FILE
+  #
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+  esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+  p
+  q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  ac_datarootdir_hack='
+  s&@datadir@&$datadir&g
+  s&@docdir@&$docdir&g
+  s&@infodir@&$infodir&g
+  s&@localedir@&$localedir&g
+  s&@mandir@&$mandir&g
+  s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
+      "$ac_tmp/out"`; test -z "$ac_out"; } &&
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined" >&2;}
+
+  rm -f "$ac_tmp/stdin"
+  case $ac_file in
+  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+  esac \
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+  :H)
+  #
+  # CONFIG_HEADER
+  #
+  if test x"$ac_file" != x-; then
+    {
+      $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+    } >"$ac_tmp/config.h" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      rm -f "$ac_file"
+      mv "$ac_tmp/config.h" "$ac_file" \
+	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
+    fi
+  else
+    $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+      || as_fn_error $? "could not create -" "$LINENO" 5
+  fi
+ ;;
+
+  :C)  { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+  esac
+
+
+  case $ac_file$ac_mode in
+    "default":C) echo timestamp > stamp-h; echo timestamp > lib/stamp-h ;;
+
+  esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
+
+# vi: set ts=8 sw=2 :

+ 379 - 0
lib/libelf/configure.in

@@ -0,0 +1,379 @@
+# configure.in - Configure template for libelf.
+# Process this file with autoconf to produce a configure script.
+# Copyright (C) 1995 - 2006 Michael Riepe
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+# @(#) $Id: configure.in,v 1.41 2008/05/23 08:17:56 michael Exp $
+
+AC_INIT(VERSION)
+AC_CONFIG_HEADER(config.h lib/sys_elf.h)
+
+AC_PREREQ(2.13)
+
+mr_PACKAGE(libelf)
+
+dnl NOTE: there must be at least one .po file!
+ALL_LINGUAS=`cd $srcdir/po && echo *.po | sed 's/\.po//g'`
+
+dnl Assuming all arguments have already been processed...
+set `echo $VERSION | sed 's/\./ /g'`
+MAJOR=${1-1}
+MINOR=${2-0}
+PATCH=${3-0}
+AC_SUBST(MAJOR)
+
+dnl Checks for programs.
+AC_PROG_MAKE_SET
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_RANLIB
+AC_PROG_LN_S
+
+dnl Checks for libraries.
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS(unistd.h stdint.h fcntl.h)
+AC_CHECK_HEADERS(elf.h sys/elf.h link.h sys/link.h)
+AC_CACHE_CHECK([if ${CC} can compile elf.h], libelf_cv_elf_h_works, [
+  AC_TRY_COMPILE(
+    [#if HAVE_ELF_H
+    #include <elf.h>
+    #elif HAVE_SYS_ELF_H
+    #include <sys/elf.h>
+    #endif],
+    [Elf32_Ehdr dummy],
+    [libelf_cv_elf_h_works=yes],
+    [libelf_cv_elf_h_works=no])
+])
+if test "$libelf_cv_elf_h_works" = no; then
+  ac_cv_header_elf_h=no
+  ac_cv_header_sys_elf_h=no
+fi
+if test "$ac_cv_header_elf_h" = yes; then
+  AC_DEFINE(__LIBELF_HEADER_ELF_H, [<elf.h>])
+elif test "$ac_cv_header_sys_elf_h" = yes; then
+  AC_DEFINE(__LIBELF_HEADER_ELF_H, [<sys/elf.h>])
+fi
+
+AC_CHECK_HEADERS(ar.h libelf.h nlist.h gelf.h)
+AC_MSG_CHECKING([whether to install <libelf.h>, <nlist.h> and <gelf.h>])
+AC_ARG_ENABLE(compat,
+  [  --enable-compat         install <libelf.h>, <nlist.h> and <gelf.h> (default: auto)],
+  [DO_COMPAT="$enableval"],
+  [if test "$ac_cv_header_libelf_h$ac_cv_header_nlist_h$ac_cv_header_gelf_h" = yesyesyes
+  then DO_COMPAT=no
+  else DO_COMPAT=yes
+  fi])
+AC_MSG_RESULT($DO_COMPAT)
+AC_SUBST(DO_COMPAT)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_TYPE_OFF_T
+AC_TYPE_SIZE_T
+
+AC_CHECK_SIZEOF(short,2)
+AC_CHECK_SIZEOF(int,4)
+AC_CHECK_SIZEOF(long,4)
+AC_CHECK_SIZEOF(long long,0)
+# Windows port
+AC_CHECK_SIZEOF(__int64, 0)
+
+if test "$ac_cv_header_elf_h" = yes \
+|| test "$ac_cv_header_sys_elf_h" = yes; then
+
+  # Slowaris declares Elf32_Dyn in <link.h>.
+  # QNX declares Elf32_Dyn in <sys/link.h>.
+  AC_CACHE_CHECK([for struct Elf32_Dyn], libelf_cv_struct_elf32_dyn, [
+    AC_TRY_COMPILE([#include __LIBELF_HEADER_ELF_H], [Elf32_Dyn x],
+      [libelf_cv_struct_elf32_dyn=yes],
+      AC_TRY_COMPILE([#include <link.h>], [Elf32_Dyn x],
+	[libelf_cv_struct_elf32_dyn=link.h],
+	AC_TRY_COMPILE([#include <sys/link.h>], [Elf32_Dyn x],
+	  [libelf_cv_struct_elf32_dyn=sys/link.h],
+	  [libelf_cv_struct_elf32_dyn=no])))])
+  if test "$libelf_cv_struct_elf32_dyn" = link.h; then
+    AC_DEFINE(__LIBELF_NEED_LINK_H)
+  elif test "$libelf_cv_struct_elf32_dyn" = sys/link.h; then
+    AC_DEFINE(__LIBELF_NEED_SYS_LINK_H)
+  elif test "$libelf_cv_struct_elf32_dyn" = no; then
+    AC_MSG_ERROR([no declaration for Elf32_Dyn])
+  fi
+
+  # Linux declares struct nlist in <elf.h>.
+  AC_CACHE_CHECK([for struct nlist in elf.h], libelf_cv_struct_nlist, [
+    AC_TRY_COMPILE([#include __LIBELF_HEADER_ELF_H], [struct nlist nl],
+      [libelf_cv_struct_nlist=yes],
+      [libelf_cv_struct_nlist=no])])
+  if test "$libelf_cv_struct_nlist" = yes; then
+    AC_DEFINE(HAVE_STRUCT_NLIST_DECLARATION)
+  fi
+
+  # Check for 64-bit data types.
+  AC_CACHE_CHECK([for struct Elf64_Ehdr], libelf_cv_struct_elf64_ehdr,
+    AC_TRY_COMPILE([#include __LIBELF_HEADER_ELF_H],
+      [Elf64_Ehdr x],
+      [libelf_cv_struct_elf64_ehdr=yes],
+      [libelf_cv_struct_elf64_ehdr=no]))
+
+  # Linux lacks typedefs for scalar ELF64_* types.
+  AC_CACHE_CHECK([for Elf64_Addr], libelf_cv_type_elf64_addr,
+    AC_TRY_COMPILE([#include __LIBELF_HEADER_ELF_H],
+      [Elf64_Addr x],
+      [libelf_cv_type_elf64_addr=yes],
+      [libelf_cv_type_elf64_addr=no]))
+
+  # IRIX' struct Elf64_Rel is slightly different. Ugh.
+  AC_CACHE_CHECK([for struct Elf64_Rel], libelf_cv_struct_elf64_rel,
+    AC_TRY_COMPILE([#include __LIBELF_HEADER_ELF_H],
+      [Elf64_Rel x; x.r_info = 1],
+      [libelf_cv_struct_elf64_rel=yes],
+      AC_TRY_COMPILE([#include __LIBELF_HEADER_ELF_H],
+	[Elf64_Rel x; x.r_sym = 1],
+	[libelf_cv_struct_elf64_rel=irix],
+	[libelf_cv_struct_elf64_rel=no])))
+
+  case "$libelf_cv_struct_elf64_ehdr:\
+$libelf_cv_type_elf64_addr:\
+$libelf_cv_struct_elf64_rel" in
+    yes:yes:yes)
+      libelf_64bit=yes;;
+    yes:yes:irix)
+      AC_DEFINE(__LIBELF64_IRIX)
+      libelf_64bit=yes;;
+    yes:no:yes)
+      AC_DEFINE(__LIBELF64_LINUX)
+      libelf_64bit=yes;;
+    *)
+      libelf_64bit=no;;
+  esac
+
+  # Check for symbol versioning definitions
+  AC_CACHE_CHECK([for Elf32_Verdef], libelf_cv_verdef32,
+    AC_TRY_COMPILE(
+      [#include __LIBELF_HEADER_ELF_H
+      #if __LIBELF_NEED_LINK_H
+      #include <link.h>	/* Solaris wants this */
+      #endif],
+      [struct {
+	Elf32_Verdef vd;
+	Elf32_Verdaux vda;
+	Elf32_Verneed vn;
+	Elf32_Vernaux vna;
+      } x],
+      [libelf_cv_verdef32=yes],
+      [libelf_cv_verdef32=no]))
+
+  AC_CACHE_CHECK([for Elf64_Verdef], libelf_cv_verdef64,
+    AC_TRY_COMPILE(
+      [#include __LIBELF_HEADER_ELF_H
+      #if __LIBELF_NEED_LINK_H
+      #include <link.h>	/* Solaris wants this */
+      #endif],
+      [struct {
+	Elf64_Verdef vd;
+	Elf64_Verdaux vda;
+	Elf64_Verneed vn;
+	Elf64_Vernaux vna;
+      } x],
+      [libelf_cv_verdef64=yes],
+      [libelf_cv_verdef64=no]))
+
+  AC_CACHE_CHECK([for SHT_SUNW_verdef], libelf_cv_sun_verdef,
+    AC_TRY_COMPILE([#include __LIBELF_HEADER_ELF_H],
+      [Elf32_Word x = SHT_SUNW_verdef + SHT_SUNW_verneed + SHT_SUNW_versym],
+      [libelf_cv_sun_verdef=yes],
+      [libelf_cv_sun_verdef=no]))
+
+  AC_CACHE_CHECK([for SHT_GNU_verdef], libelf_cv_gnu_verdef,
+    AC_TRY_COMPILE([#include __LIBELF_HEADER_ELF_H],
+      [Elf32_Word x = SHT_GNU_verdef + SHT_GNU_verneed + SHT_GNU_versym],
+      [libelf_cv_gnu_verdef=yes],
+      [libelf_cv_gnu_verdef=no]))
+else
+  # lib/elf_repl.h supports 64-bit
+  libelf_64bit=yes
+
+  # lib/elf_repl.h supports symbol versioning
+  libelf_cv_verdef32=yes
+  libelf_cv_verdef64=yes
+  libelf_cv_sun_verdef=yes
+  libelf_cv_gnu_verdef=yes
+fi
+
+AC_CACHE_CHECK([for 64-bit integer], libelf_cv_int64, [
+  if test "$ac_cv_sizeof_long" = 8; then
+    libelf_cv_int64='long'
+  elif test "$ac_cv_sizeof___int64" = 8; then
+    libelf_cv_int64='__int64'
+  elif test "$ac_cv_sizeof_long_long" = 8; then
+    libelf_cv_int64='long long'
+  else
+    libelf_cv_int64=no
+  fi])
+if test "$libelf_cv_int64" = no; then
+  libelf_64bit=no
+else
+  AC_DEFINE_UNQUOTED(__libelf_i64_t, [$libelf_cv_int64])
+  AC_DEFINE_UNQUOTED(__libelf_u64_t, [unsigned $libelf_cv_int64])
+fi
+
+AC_CACHE_CHECK([for 32-bit integer], libelf_cv_int32, [
+  if test "$ac_cv_sizeof_int" = 4; then
+    libelf_cv_int32='int'
+  elif test "$ac_cv_sizeof_long" = 4; then
+    libelf_cv_int32='long'
+  else
+    libelf_cv_int32=no
+  fi])
+if test "$libelf_cv_int32" = no; then
+  AC_MSG_ERROR([neither int nor long is 32-bit])
+else
+  AC_DEFINE_UNQUOTED(__libelf_i32_t, [$libelf_cv_int32])
+  AC_DEFINE_UNQUOTED(__libelf_u32_t, [unsigned $libelf_cv_int32])
+fi
+
+AC_CACHE_CHECK([for 16-bit integer], libelf_cv_int16, [
+  if test "$ac_cv_sizeof_short" = 2; then
+    libelf_cv_int16='short'
+  elif test "$ac_cv_sizeof_int" = 2; then
+    libelf_cv_int16='int'
+  else
+    libelf_cv_int16=no
+  fi])
+if test "$libelf_cv_int16" = no; then
+  AC_MSG_ERROR([neither short nor int is 16-bit])
+else
+  AC_DEFINE_UNQUOTED(__libelf_i16_t, [$libelf_cv_int16])
+  AC_DEFINE_UNQUOTED(__libelf_u16_t, [unsigned $libelf_cv_int16])
+fi
+
+dnl Checks for library functions.
+AC_FUNC_MMAP
+AC_CHECK_FUNCS(ftruncate memcmp memcpy memmove)
+AC_REPLACE_FUNCS(memset)
+if test "$ac_cv_func_memset" = yes; then
+  AC_DEFINE(HAVE_MEMSET)
+fi
+
+AC_CACHE_CHECK([whether overlapping arrays are copied correctly],
+  libelf_cv_working_memmove,
+  [AC_TRY_RUN(changequote(<<, >>)dnl
+<<#include "confdefs.h"
+#if HAVE_MEMMOVE
+extern void *memmove();
+#else
+extern void bcopy();
+#define memmove(d,s,n) bcopy((s),(d),(n))
+#endif
+extern int strcmp();
+main() {
+  char buf[] = "0123456789";
+  memmove(buf + 1, buf, 9);
+  if (strcmp(buf, "0012345678")) exit(1);
+  exit(0);
+}>>, changequote([, ])dnl
+    libelf_cv_working_memmove=yes,
+    libelf_cv_working_memmove=no,
+    libelf_cv_working_memmove='maybe not')])
+if test "$libelf_cv_working_memmove" != yes; then
+  AC_DEFINE(HAVE_BROKEN_MEMMOVE)
+fi
+
+AC_CACHE_CHECK([the coffee machine], mr_cv_coffee_machine,
+  [mr_cv_coffee_machine='empty - operator may not work as expected'])
+
+dnl Check for 64-bit support.
+AC_MSG_CHECKING([whether 64-bit ELF support is sufficient])
+AC_MSG_RESULT($libelf_64bit)
+AC_MSG_CHECKING([whether to include 64-bit support])
+if test "$libelf_64bit" = no; then
+  libelf_enable_64bit=no
+else
+  AC_ARG_ENABLE(elf64,
+    [  --enable-elf64          compile in 64-bit support (default: auto)],
+    [libelf_enable_64bit="$enableval"],
+    [libelf_enable_64bit=yes])
+fi
+AC_MSG_RESULT($libelf_enable_64bit)
+if test "$libelf_enable_64bit" = yes; then
+  AC_DEFINE(__LIBELF64)
+fi
+
+AC_MSG_CHECKING([whether versioning support is sufficient])
+libelf_versioning=no
+case "$libelf_enable_64bit:$libelf_cv_verdef32:$libelf_cv_verdef64" in
+  no:yes:* | yes:yes:yes)
+    if test "$libelf_cv_sun_verdef" = yes; then
+      AC_DEFINE(__LIBELF_SUN_SYMBOL_VERSIONS)
+      libelf_versioning=yes
+    elif test "$libelf_cv_gnu_verdef" = yes; then
+      AC_DEFINE(__LIBELF_GNU_SYMBOL_VERSIONS)
+      libelf_versioning=yes
+    fi;;
+esac
+AC_MSG_RESULT($libelf_versioning)
+AC_MSG_CHECKING([whether to include versioning support])
+if test "$libelf_versioning" = no; then
+  libelf_enable_versioning=no
+else
+  AC_ARG_ENABLE(versioning,
+    [  --enable-versioning     compile in versioning support (default: auto)],
+    [libelf_enable_versioning="$enableval"],
+    [libelf_enable_versioning=yes])
+fi
+AC_MSG_RESULT($libelf_enable_versioning)
+if test "$libelf_enable_versioning" = yes; then
+  AC_DEFINE(__LIBELF_SYMBOL_VERSIONS)
+fi
+
+dnl Check for NLS support.
+mr_ENABLE_NLS
+dnl this is for gmo2msg...
+LIBINTL=
+AC_CHECK_LIB(intl, gettext, [LIBINTL=-lintl])
+AC_SUBST(LIBINTL)
+
+dnl Check for shared library support.
+mr_ENABLE_SHARED
+
+dnl Check for extended ELF format support
+AC_ARG_ENABLE(extended-format,
+  [  --enable-extended-format    support extended file formats (default: no)],
+  [mr_enable_extended_format="$enableval"],
+  [mr_enable_extended_format=no])
+if test "$mr_enable_extended_format" = yes; then
+  AC_DEFINE(ENABLE_EXTENDED_FORMAT)
+fi
+
+dnl Check if ELF sanity checks should be enabled
+AC_ARG_ENABLE(sanity-checks,
+  [  --enable-sanity-checks      enable sanity checks by default (default: yes)],
+  [mr_enable_sanity_checks="$enableval"],
+  [mr_enable_sanity_checks=yes])
+if test "$mr_enable_sanity_checks" = yes; then
+  AC_DEFINE(ENABLE_SANITY_CHECKS)
+fi
+
+dnl Check for debug support.
+mr_ENABLE_DEBUG
+
+AC_OUTPUT([Makefile lib/Makefile po/Makefile libelf.pc],
+  [echo timestamp > stamp-h; echo timestamp > lib/stamp-h])
+
+# vi: set ts=8 sw=2 :

+ 119 - 0
lib/libelf/install-sh

@@ -0,0 +1,119 @@
+#!/bin/sh
+
+#
+# install - install a program, script, or datafile
+# This comes from X11R5; it is not part of GNU.
+#
+# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+#
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+
+instcmd="$mvprog"
+chmodcmd=""
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+
+while [ x"$1" != x ]; do
+    case $1 in
+	-c) instcmd="$cpprog"
+	    shift
+	    continue;;
+
+	-m) chmodcmd="$chmodprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-o) chowncmd="$chownprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-g) chgrpcmd="$chgrpprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-s) stripcmd="$stripprog"
+	    shift
+	    continue;;
+
+	*)  if [ x"$src" = x ]
+	    then
+		src=$1
+	    else
+		dst=$1
+	    fi
+	    shift
+	    continue;;
+    esac
+done
+
+if [ x"$src" = x ]
+then
+	echo "install:  no input file specified"
+	exit 1
+fi
+
+if [ x"$dst" = x ]
+then
+	echo "install:  no destination specified"
+	exit 1
+fi
+
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+if [ -d $dst ]
+then
+	dst="$dst"/`basename $src`
+fi
+
+# Make a temp file name in the proper directory.
+
+dstdir=`dirname $dst`
+dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+$doit $instcmd $src $dsttmp
+
+# and set any options; do chmod last to preserve setuid bits
+
+if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi
+if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi
+if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi
+if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi
+
+# Now rename the file to the real destination.
+
+$doit $rmcmd $dst
+$doit $mvcmd $dsttmp $dst
+
+
+exit 0

+ 155 - 0
lib/libelf/lib/32.fsize.c

@@ -0,0 +1,155 @@
+/*
+32.fsize.c - implementation of the elf{32,64}_fsize(3) functions.
+Copyright (C) 1995 - 2001 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+#include <ext_types.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: 32.fsize.c,v 1.13 2008/05/23 08:15:33 michael Exp $";
+#endif /* lint */
+
+const size_t
+_elf_fmsize[2][EV_CURRENT - EV_NONE][ELF_T_NUM][2] = {
+    /* ELFCLASS32 */
+    {
+	/* version 1 */
+	{
+	    { sizeof(unsigned char),  sizeof(unsigned char)      },
+	    { sizeof(Elf32_Addr),     sizeof(__ext_Elf32_Addr)   },
+	    { sizeof(Elf32_Dyn),      sizeof(__ext_Elf32_Dyn)    },
+	    { sizeof(Elf32_Ehdr),     sizeof(__ext_Elf32_Ehdr)   },
+	    { sizeof(Elf32_Half),     sizeof(__ext_Elf32_Half)   },
+	    { sizeof(Elf32_Off),      sizeof(__ext_Elf32_Off)    },
+	    { sizeof(Elf32_Phdr),     sizeof(__ext_Elf32_Phdr)   },
+	    { sizeof(Elf32_Rela),     sizeof(__ext_Elf32_Rela)   },
+	    { sizeof(Elf32_Rel),      sizeof(__ext_Elf32_Rel)    },
+	    { sizeof(Elf32_Shdr),     sizeof(__ext_Elf32_Shdr)   },
+	    { sizeof(Elf32_Sword),    sizeof(__ext_Elf32_Sword)  },
+	    { sizeof(Elf32_Sym),      sizeof(__ext_Elf32_Sym)    },
+	    { sizeof(Elf32_Word),     sizeof(__ext_Elf32_Word)   },
+	    { 0, 0 },	/* there is no Elf32_Sxword */
+	    { 0, 0 },	/* there is no Elf32_Xword */
+	    /* XXX: check Solaris values */
+	    { 0, 0 },	/* Elf32_Verdef/Verdaux size varies */
+	    { 0, 0 },	/* Elf32_Verneed/Vernaux size varies */
+	},
+    },
+#if __LIBELF64
+    /* ELFCLASS64 */
+    {
+	/* version 1 */
+	{
+	    { sizeof(unsigned char),  sizeof(unsigned char)      },
+	    { sizeof(Elf64_Addr),     sizeof(__ext_Elf64_Addr)   },
+	    { sizeof(Elf64_Dyn),      sizeof(__ext_Elf64_Dyn)    },
+	    { sizeof(Elf64_Ehdr),     sizeof(__ext_Elf64_Ehdr)   },
+	    { sizeof(Elf64_Half),     sizeof(__ext_Elf64_Half)   },
+	    { sizeof(Elf64_Off),      sizeof(__ext_Elf64_Off)    },
+	    { sizeof(Elf64_Phdr),     sizeof(__ext_Elf64_Phdr)   },
+	    { sizeof(Elf64_Rela),     sizeof(__ext_Elf64_Rela)   },
+	    { sizeof(Elf64_Rel),      sizeof(__ext_Elf64_Rel)    },
+	    { sizeof(Elf64_Shdr),     sizeof(__ext_Elf64_Shdr)   },
+	    { sizeof(Elf64_Sword),    sizeof(__ext_Elf64_Sword)  },
+	    { sizeof(Elf64_Sym),      sizeof(__ext_Elf64_Sym)    },
+	    { sizeof(Elf64_Word),     sizeof(__ext_Elf64_Word)   },
+	    { sizeof(Elf64_Sxword),   sizeof(__ext_Elf64_Sxword) },
+	    { sizeof(Elf64_Xword),    sizeof(__ext_Elf64_Xword)  },
+	    /* XXX: check Solaris values */
+	    { 0, 0 },	/* Elf64_Verdef/Verdaux size varies */
+	    { 0, 0 },	/* Elf64_Verneed/Vernaux size varies */
+	},
+    },
+#endif /* __LIBELF64 */
+};
+
+static size_t
+_elf_fsize(unsigned cls, Elf_Type type, unsigned ver) {
+    size_t n = 0;
+
+    if (!valid_version(ver)) {
+	seterr(ERROR_UNKNOWN_VERSION);
+    }
+    else if (!valid_type(type)) {
+	seterr(ERROR_UNKNOWN_TYPE);
+    }
+    else if (!(n = _fsize(cls, ver, type))) {
+	seterr(ERROR_UNKNOWN_TYPE);
+    }
+    return n;
+}
+
+size_t
+elf32_fsize(Elf_Type type, size_t count, unsigned ver) {
+    return count * _elf_fsize(ELFCLASS32, type, ver);
+}
+
+#if __LIBELF64
+
+size_t
+elf64_fsize(Elf_Type type, size_t count, unsigned ver) {
+    return count * _elf_fsize(ELFCLASS64, type, ver);
+}
+
+size_t
+gelf_fsize(Elf *elf, Elf_Type type, size_t count, unsigned ver) {
+    if (elf) {
+	if (elf->e_kind != ELF_K_ELF) {
+	    seterr(ERROR_NOTELF);
+	}
+	else if (valid_class(elf->e_class)) {
+	    return count * _elf_fsize(elf->e_class, type, ver);
+	}
+	else {
+	    seterr(ERROR_UNKNOWN_CLASS);
+	}
+    }
+    return 0;
+}
+
+/*
+ * Extension: report memory size
+ */
+size_t
+gelf_msize(Elf *elf, Elf_Type type, size_t count, unsigned ver) {
+    size_t n;
+
+    if (elf) {
+	if (elf->e_kind != ELF_K_ELF) {
+	    seterr(ERROR_NOTELF);
+	}
+	else if (!valid_class(elf->e_class)) {
+	    seterr(ERROR_UNKNOWN_CLASS);
+	}
+	else if (!valid_version(ver)) {
+	    seterr(ERROR_UNKNOWN_VERSION);
+	}
+	else if (!valid_type(type)) {
+	    seterr(ERROR_UNKNOWN_TYPE);
+	}
+	else if (!(n = _msize(elf->e_class, ver, type))) {
+	    seterr(ERROR_UNKNOWN_TYPE);
+	}
+	else {
+	    return count * n;
+	}
+    }
+    return 0;
+}
+
+#endif /* __LIBELF64 */

+ 56 - 0
lib/libelf/lib/32.getehdr.c

@@ -0,0 +1,56 @@
+/*
+32.getehdr.c - implementation of the elf{32,64}_getehdr(3) functions.
+Copyright (C) 1995 - 1998 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: 32.getehdr.c,v 1.9 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+char*
+_elf_getehdr(Elf *elf, unsigned cls) {
+    if (!elf) {
+	return NULL;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    if (elf->e_kind != ELF_K_ELF) {
+	seterr(ERROR_NOTELF);
+    }
+    else if (elf->e_class != cls) {
+	seterr(ERROR_CLASSMISMATCH);
+    }
+    else if (elf->e_ehdr || _elf_cook(elf)) {
+	return elf->e_ehdr;
+    }
+    return NULL;
+}
+
+Elf32_Ehdr*
+elf32_getehdr(Elf *elf) {
+    return (Elf32_Ehdr*)_elf_getehdr(elf, ELFCLASS32);
+}
+
+#if __LIBELF64
+
+Elf64_Ehdr*
+elf64_getehdr(Elf *elf) {
+    return (Elf64_Ehdr*)_elf_getehdr(elf, ELFCLASS64);
+}
+
+#endif /* __LIBELF64 */

+ 56 - 0
lib/libelf/lib/32.getphdr.c

@@ -0,0 +1,56 @@
+/*
+32.getphdr.c - implementation of the elf{32,64}_getphdr(3) functions.
+Copyright (C) 1995 - 2000 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: 32.getphdr.c,v 1.11 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+char*
+_elf_getphdr(Elf *elf, unsigned cls) {
+    if (!elf) {
+	return NULL;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    if (elf->e_kind != ELF_K_ELF) {
+	seterr(ERROR_NOTELF);
+    }
+    else if (elf->e_class != cls) {
+	seterr(ERROR_CLASSMISMATCH);
+    }
+    else if (elf->e_ehdr || _elf_cook(elf)) {
+	return elf->e_phdr;
+    }
+    return NULL;
+}
+
+Elf32_Phdr*
+elf32_getphdr(Elf *elf) {
+    return (Elf32_Phdr*)_elf_getphdr(elf, ELFCLASS32);
+}
+
+#if __LIBELF64
+
+Elf64_Phdr*
+elf64_getphdr(Elf *elf) {
+    return (Elf64_Phdr*)_elf_getphdr(elf, ELFCLASS64);
+}
+
+#endif /* __LIBELF64 */

+ 58 - 0
lib/libelf/lib/32.getshdr.c

@@ -0,0 +1,58 @@
+/*
+32.getshdr.c - implementation of the elf{32,64}_getshdr(3) functions.
+Copyright (C) 1995 - 1998 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: 32.getshdr.c,v 1.10 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+Elf32_Shdr*
+elf32_getshdr(Elf_Scn *scn) {
+    if (!scn) {
+	return NULL;
+    }
+    elf_assert(scn->s_magic == SCN_MAGIC);
+    elf_assert(scn->s_elf);
+    elf_assert(scn->s_elf->e_magic == ELF_MAGIC);
+    if (scn->s_elf->e_class == ELFCLASS32) {
+	return &scn->s_shdr32;
+    }
+    seterr(ERROR_CLASSMISMATCH);
+    return NULL;
+}
+
+#if __LIBELF64
+
+Elf64_Shdr*
+elf64_getshdr(Elf_Scn *scn) {
+    if (!scn) {
+	return NULL;
+    }
+    elf_assert(scn->s_magic == SCN_MAGIC);
+    elf_assert(scn->s_elf);
+    elf_assert(scn->s_elf->e_magic == ELF_MAGIC);
+    if (scn->s_elf->e_class == ELFCLASS64) {
+	return &scn->s_shdr64;
+    }
+    seterr(ERROR_CLASSMISMATCH);
+    return NULL;
+}
+
+#endif /* __LIBELF64 */

+ 80 - 0
lib/libelf/lib/32.newehdr.c

@@ -0,0 +1,80 @@
+/*
+ * 32.newehdr.c - implementation of the elf{32,64}_newehdr(3) functions.
+ * Copyright (C) 1995 - 2006 Michael Riepe
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: 32.newehdr.c,v 1.16 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+static char*
+_elf_newehdr(Elf *elf, unsigned cls) {
+    size_t size;
+
+    if (!elf) {
+	return NULL;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    if (elf->e_readable) {
+	return _elf_getehdr(elf, cls);
+    }
+    else if (!elf->e_ehdr) {
+	size = _msize(cls, _elf_version, ELF_T_EHDR);
+	elf_assert(size);
+	if ((elf->e_ehdr = (char*)malloc(size))) {
+	    memset(elf->e_ehdr, 0, size);
+	    elf->e_ehdr_flags |= ELF_F_DIRTY;
+	    elf->e_kind = ELF_K_ELF;
+	    elf->e_class = cls;
+	    return elf->e_ehdr;
+	}
+	seterr(ERROR_MEM_EHDR);
+    }
+    else if (elf->e_class != cls) {
+	seterr(ERROR_CLASSMISMATCH);
+    }
+    else {
+	elf_assert(elf->e_kind == ELF_K_ELF);
+	return elf->e_ehdr;
+    }
+    return NULL;
+}
+
+Elf32_Ehdr*
+elf32_newehdr(Elf *elf) {
+    return (Elf32_Ehdr*)_elf_newehdr(elf, ELFCLASS32);
+}
+
+#if __LIBELF64
+
+Elf64_Ehdr*
+elf64_newehdr(Elf *elf) {
+    return (Elf64_Ehdr*)_elf_newehdr(elf, ELFCLASS64);
+}
+
+unsigned long
+gelf_newehdr(Elf *elf, int cls) {
+    if (!valid_class(cls) || !_msize(cls, _elf_version, ELF_T_EHDR)) {
+	seterr(ERROR_UNKNOWN_CLASS);
+	return 0;
+    }
+    return (unsigned long)_elf_newehdr(elf, cls);
+}
+
+#endif /* __LIBELF64 */

+ 118 - 0
lib/libelf/lib/32.newphdr.c

@@ -0,0 +1,118 @@
+/*
+ * 32.newphdr.c - implementation of the elf{32,64}_newphdr(3) functions.
+ * Copyright (C) 1995 - 2006 Michael Riepe
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: 32.newphdr.c,v 1.16 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+static char*
+_elf_newphdr(Elf *elf, size_t count, unsigned cls) {
+    size_t extcount = 0;
+    Elf_Scn *scn = NULL;
+    char *phdr = NULL;
+    size_t size;
+
+    if (!elf) {
+	return NULL;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    if (!elf->e_ehdr && !elf->e_readable) {
+	seterr(ERROR_NOEHDR);
+    }
+    else if (elf->e_kind != ELF_K_ELF) {
+	seterr(ERROR_NOTELF);
+    }
+    else if (elf->e_class != cls) {
+	seterr(ERROR_CLASSMISMATCH);
+    }
+    else if (elf->e_ehdr || _elf_cook(elf)) {
+	size = _msize(cls, _elf_version, ELF_T_PHDR);
+	elf_assert(size);
+	if (!(scn = _elf_first_scn(elf))) {
+	    return NULL;
+	}
+	if (count) {
+	    if (!(phdr = (char*)malloc(count * size))) {
+		seterr(ERROR_MEM_PHDR);
+		return NULL;
+	    }
+	    memset(phdr, 0, count * size);
+	}
+	elf_assert(elf->e_ehdr);
+	elf->e_phnum = count;
+	if (count >= PN_XNUM) {
+	    /*
+	     * get NULL section (create it if necessary)
+	     */
+	    extcount = count;
+	    count = PN_XNUM;
+	}
+	if (cls == ELFCLASS32) {
+	    ((Elf32_Ehdr*)elf->e_ehdr)->e_phnum = count;
+	    scn->s_shdr32.sh_info = extcount;
+	}
+#if __LIBELF64
+	else if (cls == ELFCLASS64) {
+	    ((Elf64_Ehdr*)elf->e_ehdr)->e_phnum = count;
+	    scn->s_shdr64.sh_info = extcount;
+	}
+#endif /* __LIBELF64 */
+	else {
+	    seterr(ERROR_UNIMPLEMENTED);
+	    if (phdr) {
+		free(phdr);
+	    }
+	    return NULL;
+	}
+	if (elf->e_phdr) {
+	    free(elf->e_phdr);
+	}
+	elf->e_phdr = phdr;
+	elf->e_phdr_flags |= ELF_F_DIRTY;
+	elf->e_ehdr_flags |= ELF_F_DIRTY;
+	scn->s_scn_flags |= ELF_F_DIRTY;
+	return phdr;
+    }
+    return NULL;
+}
+
+Elf32_Phdr*
+elf32_newphdr(Elf *elf, size_t count) {
+    return (Elf32_Phdr*)_elf_newphdr(elf, count, ELFCLASS32);
+}
+
+#if __LIBELF64
+
+Elf64_Phdr*
+elf64_newphdr(Elf *elf, size_t count) {
+    return (Elf64_Phdr*)_elf_newphdr(elf, count, ELFCLASS64);
+}
+
+unsigned long
+gelf_newphdr(Elf *elf, size_t phnum) {
+    if (!valid_class(elf->e_class)) {
+	seterr(ERROR_UNKNOWN_CLASS);
+	return 0;
+    }
+    return (unsigned long)_elf_newphdr(elf, phnum, elf->e_class);
+}
+
+#endif /* __LIBELF64 */

+ 438 - 0
lib/libelf/lib/32.xlatetof.c

@@ -0,0 +1,438 @@
+/*
+ * 32.xlatetof.c - implementation of the elf32_xlateto[fm](3) functions.
+ * Copyright (C) 1995 - 2006 Michael Riepe
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <private.h>
+#include <ext_types.h>
+#include <byteswap.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: 32.xlatetof.c,v 1.27 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+/*
+ * Ugly, ugly
+ */
+#ifdef _WIN32
+# define Cat2(a,b)a##b
+# define Cat3(a,b,c)a##b##c
+# define Ex1(m1,m2,a,b)m1##m2(a##b)
+# define Ex2(m1,m2,a,b,c)m1##m2(a,b##c)
+#else /* _WIN32 */
+# define x
+# if defined/**/x
+#  define Cat2(a,b)a##b
+#  define Cat3(a,b,c)a##b##c
+#  define Ex1(m1,m2,a,b)m1##m2(a##b)
+#  define Ex2(m1,m2,a,b,c)m1##m2(a,b##c)
+# else
+#  define Cat2(a,b)a/**/b
+#  define Cat3(a,b,c)a/**/b/**/c
+#  define Ex1(m1,m2,a,b)m1/**/m2(a/**/b)
+#  define Ex2(m1,m2,a,b,c)m1/**/m2(a,b/**/c)
+# endif
+# undef x
+#endif /* _WIN32 */
+
+/*
+ * auxiliary macros for execution order reversal
+ */
+#define seq_forw(a,b) a b
+#define seq_back(a,b) b a
+
+/*
+ * function instantiator
+ */
+#define copy_type_e_io(name,e,io,tfrom,tto,copy)		\
+    static size_t						\
+    Cat3(name,_,io)(unsigned char *dst, const unsigned char *src, size_t n) {	\
+	n /= sizeof(tfrom);					\
+	if (n && dst) {						\
+	    const tfrom *from = (const tfrom*)src;		\
+	    tto *to = (tto*)dst;				\
+	    size_t i;						\
+								\
+	    if (sizeof(tfrom) < sizeof(tto)) {			\
+		from += n;					\
+		to += n;					\
+		for (i = 0; i < n; i++) {			\
+		    --from;					\
+		    --to;					\
+		    copy(e,io,seq_back)				\
+		}						\
+	    }							\
+	    else {						\
+		for (i = 0; i < n; i++) {			\
+		    copy(e,io,seq_forw)				\
+		    from++;					\
+		    to++;					\
+		}						\
+	    }							\
+	}							\
+	return n * sizeof(tto);					\
+    }
+
+#define copy_type_e(name,e,type,copy)				\
+    copy_type_e_io(name,e,tom,Cat2(__ext_,type),type,copy)	\
+    copy_type_e_io(name,e,tof,type,Cat2(__ext_,type),copy)
+
+/*
+ * master function instantiator
+ */
+#define copy_type(name,version,type,copy)		\
+    copy_type_e(Cat3(name,L,version),L,type,copy)	\
+    copy_type_e(Cat3(name,M,version),M,type,copy)
+
+/*
+ * scalar copying
+ */
+#define copy_scalar_tom(type)	*to = Cat2(__load_,type)(*from);
+#define copy_scalar_tof(type)	Cat2(__store_,type)(*to, *from);
+
+/*
+ * structure member copying
+ */
+#define copy_tom(mb,type)	to->mb = Cat2(__load_,type)(from->mb);
+#define copy_tof(mb,type)	Cat2(__store_,type)(to->mb, from->mb);
+
+/*
+ * structure member copying (direction independent)
+ */
+#define copy_byte(e,io,mb)	to->mb = from->mb;
+#define copy_addr(e,io,mb)	Ex2(copy_,io,mb,u32,e)
+#define copy_half(e,io,mb)	Ex2(copy_,io,mb,u16,e)
+#define copy_off(e,io,mb)	Ex2(copy_,io,mb,u32,e)
+#define copy_sword(e,io,mb)	Ex2(copy_,io,mb,i32,e)
+#define copy_word(e,io,mb)	Ex2(copy_,io,mb,u32,e)
+#define copy_arr(e,io,mb)	\
+    array_copy(to->mb, sizeof(to->mb), from->mb, sizeof(from->mb));
+
+/*
+ * scalar copying (direction independent)
+ * these macros are used as `copy' arguments to copy_type()
+ */
+#define copy_addr_11(e,io,seq)	Ex1(copy_scalar_,io,u32,e)
+#define copy_half_11(e,io,seq)	Ex1(copy_scalar_,io,u16,e)
+#define copy_off_11(e,io,seq)	Ex1(copy_scalar_,io,u32,e)
+#define copy_sword_11(e,io,seq)	Ex1(copy_scalar_,io,i32,e)
+#define copy_word_11(e,io,seq)	Ex1(copy_scalar_,io,u32,e)
+
+/*
+ * structure copying (direction independent)
+ * these macros are used as `copy' arguments to copy_type()
+ */
+#define copy_dyn_11(e,io,seq)		\
+    seq(copy_sword(e,io,d_tag),		\
+    seq(copy_addr(e,io,d_un.d_ptr),	\
+    nullcopy))
+#define copy_ehdr_11(e,io,seq)		\
+    seq(copy_arr(e,io,e_ident),		\
+    seq(copy_half(e,io,e_type),		\
+    seq(copy_half(e,io,e_machine),	\
+    seq(copy_word(e,io,e_version),	\
+    seq(copy_addr(e,io,e_entry),	\
+    seq(copy_off(e,io,e_phoff),		\
+    seq(copy_off(e,io,e_shoff),		\
+    seq(copy_word(e,io,e_flags),	\
+    seq(copy_half(e,io,e_ehsize),	\
+    seq(copy_half(e,io,e_phentsize),	\
+    seq(copy_half(e,io,e_phnum),	\
+    seq(copy_half(e,io,e_shentsize),	\
+    seq(copy_half(e,io,e_shnum),	\
+    seq(copy_half(e,io,e_shstrndx),	\
+    nullcopy))))))))))))))
+#define copy_phdr_11(e,io,seq)		\
+    seq(copy_word(e,io,p_type),		\
+    seq(copy_off(e,io,p_offset),	\
+    seq(copy_addr(e,io,p_vaddr),	\
+    seq(copy_addr(e,io,p_paddr),	\
+    seq(copy_word(e,io,p_filesz),	\
+    seq(copy_word(e,io,p_memsz),	\
+    seq(copy_word(e,io,p_flags),	\
+    seq(copy_word(e,io,p_align),	\
+    nullcopy))))))))
+#define copy_rela_11(e,io,seq)		\
+    seq(copy_addr(e,io,r_offset),	\
+    seq(copy_word(e,io,r_info),		\
+    seq(copy_sword(e,io,r_addend),	\
+    nullcopy)))
+#define copy_rel_11(e,io,seq)		\
+    seq(copy_addr(e,io,r_offset),	\
+    seq(copy_word(e,io,r_info),		\
+    nullcopy))
+#define copy_shdr_11(e,io,seq)		\
+    seq(copy_word(e,io,sh_name),	\
+    seq(copy_word(e,io,sh_type),	\
+    seq(copy_word(e,io,sh_flags),	\
+    seq(copy_addr(e,io,sh_addr),	\
+    seq(copy_off(e,io,sh_offset),	\
+    seq(copy_word(e,io,sh_size),	\
+    seq(copy_word(e,io,sh_link),	\
+    seq(copy_word(e,io,sh_info),	\
+    seq(copy_word(e,io,sh_addralign),	\
+    seq(copy_word(e,io,sh_entsize),	\
+    nullcopy))))))))))
+#define copy_sym_11(e,io,seq)		\
+    seq(copy_word(e,io,st_name),	\
+    seq(copy_addr(e,io,st_value),	\
+    seq(copy_word(e,io,st_size),	\
+    seq(copy_byte(e,io,st_info),	\
+    seq(copy_byte(e,io,st_other),	\
+    seq(copy_half(e,io,st_shndx),	\
+    nullcopy))))))
+
+#define nullcopy /**/
+
+static size_t
+byte_copy(unsigned char *dst, const unsigned char *src, size_t n) {
+    if (n && dst && dst != src) {
+#if HAVE_BROKEN_MEMMOVE
+	size_t i;
+
+	if (dst >= src + n || dst + n <= src) {
+	    memcpy(dst, src, n);
+	}
+	else if (dst < src) {
+	    for (i = 0; i < n; i++) {
+		dst[i] = src[i];
+	    }
+	}
+	else {
+	    for (i = n; --i; ) {
+		dst[i] = src[i];
+	    }
+	}
+#else /* HAVE_BROKEN_MEMMOVE */
+	memmove(dst, src, n);
+#endif /* HAVE_BROKEN_MEMMOVE */
+    }
+    return n;
+}
+
+static void
+array_copy(unsigned char *dst, size_t dlen, const unsigned char *src, size_t slen) {
+    byte_copy(dst, src, dlen < slen ? dlen : slen);
+    if (dlen > slen) {
+	memset(dst + slen, 0, dlen - slen);
+    }
+}
+
+/*
+ * instantiate copy functions
+ */
+copy_type(addr_32,_,Elf32_Addr,copy_addr_11)
+copy_type(half_32,_,Elf32_Half,copy_half_11)
+copy_type(off_32,_,Elf32_Off,copy_off_11)
+copy_type(sword_32,_,Elf32_Sword,copy_sword_11)
+copy_type(word_32,_,Elf32_Word,copy_word_11)
+copy_type(dyn_32,11,Elf32_Dyn,copy_dyn_11)
+copy_type(ehdr_32,11,Elf32_Ehdr,copy_ehdr_11)
+copy_type(phdr_32,11,Elf32_Phdr,copy_phdr_11)
+copy_type(rela_32,11,Elf32_Rela,copy_rela_11)
+copy_type(rel_32,11,Elf32_Rel,copy_rel_11)
+copy_type(shdr_32,11,Elf32_Shdr,copy_shdr_11)
+copy_type(sym_32,11,Elf32_Sym,copy_sym_11)
+
+typedef size_t (*xlator)(unsigned char*, const unsigned char*, size_t);
+typedef xlator xltab[ELF_T_NUM][2];
+
+/*
+ * translation table (32-bit, version 1 -> version 1)
+ */
+#if PIC
+static xltab
+#else /* PIC */
+static const xltab
+#endif /* PIC */
+xlate32_11[/*encoding*/] = {
+    {
+	{ byte_copy,        byte_copy       },
+	{ addr_32L__tom,    addr_32L__tof   },
+	{ dyn_32L11_tom,    dyn_32L11_tof   },
+	{ ehdr_32L11_tom,   ehdr_32L11_tof  },
+	{ half_32L__tom,    half_32L__tof   },
+	{ off_32L__tom,	    off_32L__tof    },
+	{ phdr_32L11_tom,   phdr_32L11_tof  },
+	{ rela_32L11_tom,   rela_32L11_tof  },
+	{ rel_32L11_tom,    rel_32L11_tof   },
+	{ shdr_32L11_tom,   shdr_32L11_tof  },
+	{ sword_32L__tom,   sword_32L__tof  },
+	{ sym_32L11_tom,    sym_32L11_tof   },
+	{ word_32L__tom,    word_32L__tof   },
+	{ 0,                0               },	/* there is no Sxword */
+	{ 0,                0               },	/* there is no Xword */
+#if __LIBELF_SYMBOL_VERSIONS
+	{ _elf_verdef_32L11_tom,  _elf_verdef_32L11_tof  },
+	{ _elf_verneed_32L11_tom, _elf_verneed_32L11_tof },
+#else /* __LIBELF_SYMBOL_VERSIONS */
+	{ 0,                0               },
+	{ 0,                0               },
+#endif /* __LIBELF_SYMBOL_VERSIONS */
+    },
+    {
+	{ byte_copy,        byte_copy       },
+	{ addr_32M__tom,    addr_32M__tof   },
+	{ dyn_32M11_tom,    dyn_32M11_tof   },
+	{ ehdr_32M11_tom,   ehdr_32M11_tof  },
+	{ half_32M__tom,    half_32M__tof   },
+	{ off_32M__tom,	    off_32M__tof    },
+	{ phdr_32M11_tom,   phdr_32M11_tof  },
+	{ rela_32M11_tom,   rela_32M11_tof  },
+	{ rel_32M11_tom,    rel_32M11_tof   },
+	{ shdr_32M11_tom,   shdr_32M11_tof  },
+	{ sword_32M__tom,   sword_32M__tof  },
+	{ sym_32M11_tom,    sym_32M11_tof   },
+	{ word_32M__tom,    word_32M__tof   },
+	{ 0,                0               },	/* there is no Sxword */
+	{ 0,                0               },	/* there is no Xword */
+#if __LIBELF_SYMBOL_VERSIONS
+	{ _elf_verdef_32M11_tom,  _elf_verdef_32M11_tof  },
+	{ _elf_verneed_32M11_tom, _elf_verneed_32M11_tof },
+#else /* __LIBELF_SYMBOL_VERSIONS */
+	{ 0,                0               },
+	{ 0,                0               },
+#endif /* __LIBELF_SYMBOL_VERSIONS */
+    },
+};
+
+/*
+ * main translation table (32-bit)
+ */
+#if PIC
+static xltab*
+#else /* PIC */
+static const xltab *const
+#endif /* PIC */
+xlate32[EV_CURRENT - EV_NONE][EV_CURRENT - EV_NONE] = {
+    { xlate32_11, },
+};
+
+#define translator(sv,dv,enc,type,d)	\
+    (xlate32[(sv) - EV_NONE - 1]	\
+	    [(dv) - EV_NONE - 1]	\
+	    [(enc) - ELFDATA2LSB]	\
+	    [(type) - ELF_T_BYTE]	\
+	    [d])
+
+/*
+ * destination buffer size
+ */
+size_t
+_elf32_xltsize(const Elf_Data *src, unsigned dv, unsigned encode, int tof) {
+    Elf_Type type = src->d_type;
+    unsigned sv = src->d_version;
+    xlator op;
+
+    if (!valid_version(sv) || !valid_version(dv)) {
+	seterr(ERROR_UNKNOWN_VERSION);
+	return (size_t)-1;
+    }
+    if (tof) {
+	/*
+	 * Encoding doesn't really matter (the translator only looks at
+	 * the source, which resides in memory), but we need a proper
+	 * encoding to select a translator...
+	 */
+	encode = ELFDATA2LSB;
+    }
+    else if (!valid_encoding(encode)) {
+	seterr(ERROR_UNKNOWN_ENCODING);
+	return (size_t)-1;
+    }
+    if (!valid_type(type)) {
+	seterr(ERROR_UNKNOWN_TYPE);
+	return (size_t)-1;
+    }
+    if (!(op = translator(sv, dv, encode, type, tof))) {
+	seterr(ERROR_UNKNOWN_TYPE);
+	return (size_t)-1;
+    }
+    return (*op)(NULL, src->d_buf, src->d_size);
+}
+
+/*
+ * direction-independent translation
+ */
+static Elf_Data*
+elf32_xlate(Elf_Data *dst, const Elf_Data *src, unsigned encode, int tof) {
+    Elf_Type type;
+    int dv;
+    int sv;
+    size_t dsize;
+    size_t tmp;
+    xlator op;
+
+    if (!src || !dst) {
+	return NULL;
+    }
+    if (!src->d_buf || !dst->d_buf) {
+	seterr(ERROR_NULLBUF);
+	return NULL;
+    }
+    if (!valid_encoding(encode)) {
+	seterr(ERROR_UNKNOWN_ENCODING);
+	return NULL;
+    }
+    sv = src->d_version;
+    dv = dst->d_version;
+    if (!valid_version(sv) || !valid_version(dv)) {
+	seterr(ERROR_UNKNOWN_VERSION);
+	return NULL;
+    }
+    type = src->d_type;
+    if (!valid_type(type)) {
+	seterr(ERROR_UNKNOWN_TYPE);
+	return NULL;
+    }
+    op = translator(sv, dv, encode, type, tof);
+    if (!op) {
+	seterr(ERROR_UNKNOWN_TYPE);
+	return NULL;
+    }
+    dsize = (*op)(NULL, src->d_buf, src->d_size);
+    if (dsize == (size_t)-1) {
+	return NULL;
+    }
+    if (dst->d_size < dsize) {
+	seterr(ERROR_DST2SMALL);
+	return NULL;
+    }
+    if (dsize) {
+	tmp = (*op)(dst->d_buf, src->d_buf, src->d_size);
+	if (tmp == (size_t)-1) {
+	    return NULL;
+	}
+	elf_assert(tmp == dsize);
+    }
+    dst->d_size = dsize;
+    dst->d_type = type;
+    return dst;
+}
+
+/*
+ * finally, the "official" translation functions
+ */
+Elf_Data*
+elf32_xlatetom(Elf_Data *dst, const Elf_Data *src, unsigned encode) {
+    return elf32_xlate(dst, src, encode, 0);
+}
+
+Elf_Data*
+elf32_xlatetof(Elf_Data *dst, const Elf_Data *src, unsigned encode) {
+    return elf32_xlate(dst, src, encode, 1);
+}

+ 512 - 0
lib/libelf/lib/64.xlatetof.c

@@ -0,0 +1,512 @@
+/*
+ * 64.xlatetof.c - implementation of the elf64_xlateto[fm](3) functions.
+ * Copyright (C) 1995 - 2006 Michael Riepe
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <private.h>
+#include <ext_types.h>
+#include <byteswap.h>
+
+#if __LIBELF64
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: 64.xlatetof.c,v 1.27 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+/*
+ * Ugly, ugly
+ */
+#ifdef _WIN32
+# define Cat2(a,b)a##b
+# define Cat3(a,b,c)a##b##c
+# define Ex1(m1,m2,a,b)m1##m2(a##b)
+# define Ex2(m1,m2,a,b,c)m1##m2(a,b##c)
+#else /* _WIN32 */
+# define x
+# if defined/**/x
+#  define Cat2(a,b)a##b
+#  define Cat3(a,b,c)a##b##c
+#  define Ex1(m1,m2,a,b)m1##m2(a##b)
+#  define Ex2(m1,m2,a,b,c)m1##m2(a,b##c)
+# else
+#  define Cat2(a,b)a/**/b
+#  define Cat3(a,b,c)a/**/b/**/c
+#  define Ex1(m1,m2,a,b)m1/**/m2(a/**/b)
+#  define Ex2(m1,m2,a,b,c)m1/**/m2(a,b/**/c)
+# endif
+# undef x
+#endif /* _WIN32 */
+
+/*
+ * auxiliary macros for execution order reversal
+ */
+#define seq_forw(a,b) a b
+#define seq_back(a,b) b a
+
+/*
+ * function instantiator
+ */
+#define copy_type_e_io(name,e,io,tfrom,tto,copy)		\
+    static size_t						\
+    Cat3(name,_,io)(unsigned char *dst, const unsigned char *src, size_t n) {	\
+	n /= sizeof(tfrom);					\
+	if (n && dst) {						\
+	    const tfrom *from = (const tfrom*)src;		\
+	    tto *to = (tto*)dst;				\
+	    size_t i;						\
+								\
+	    if (sizeof(tfrom) < sizeof(tto)) {			\
+		from += n;					\
+		to += n;					\
+		for (i = 0; i < n; i++) {			\
+		    --from;					\
+		    --to;					\
+		    copy(e,io,seq_back)				\
+		}						\
+	    }							\
+	    else {						\
+		for (i = 0; i < n; i++) {			\
+		    copy(e,io,seq_forw)				\
+		    from++;					\
+		    to++;					\
+		}						\
+	    }							\
+	}							\
+	return n * sizeof(tto);					\
+    }
+
+#define copy_type_e(name,e,type,copy)				\
+    copy_type_e_io(name,e,tom,Cat2(__ext_,type),type,copy)	\
+    copy_type_e_io(name,e,tof,type,Cat2(__ext_,type),copy)
+
+/*
+ * master function instantiator
+ */
+#define copy_type(name,version,type,copy)		\
+    copy_type_e(Cat3(name,L,version),L,type,copy)	\
+    copy_type_e(Cat3(name,M,version),M,type,copy)
+
+/*
+ * scalar copying
+ */
+#define copy_scalar_tom(type)	*to = Cat2(__load_,type)(*from);
+#define copy_scalar_tof(type)	Cat2(__store_,type)(*to, *from);
+
+/*
+ * structure member copying
+ */
+#define copy_tom(mb,type)	to->mb = Cat2(__load_,type)(from->mb);
+#define copy_tof(mb,type)	Cat2(__store_,type)(to->mb, from->mb);
+
+/*
+ * structure member copying (direction independent)
+ */
+#define copy_byte(e,io,mb)	to->mb = from->mb;
+#define copy_addr(e,io,mb)	Ex2(copy_,io,mb,u64,e)
+#define copy_half(e,io,mb)	Ex2(copy_,io,mb,u16,e)
+#define copy_off(e,io,mb)	Ex2(copy_,io,mb,u64,e)
+#define copy_sword(e,io,mb)	Ex2(copy_,io,mb,i32,e)
+#define copy_word(e,io,mb)	Ex2(copy_,io,mb,u32,e)
+#define copy_sxword(e,io,mb)	Ex2(copy_,io,mb,i64,e)
+#define copy_xword(e,io,mb)	Ex2(copy_,io,mb,u64,e)
+#define copy_arr(e,io,mb)	\
+    array_copy(to->mb, sizeof(to->mb), from->mb, sizeof(from->mb));
+
+/*
+ * scalar copying (direction independent)
+ * these macros are used as `copy' arguments to copy_type()
+ */
+#define copy_addr_11(e,io,seq)	Ex1(copy_scalar_,io,u64,e)
+#define copy_half_11(e,io,seq)	Ex1(copy_scalar_,io,u16,e)
+#define copy_off_11(e,io,seq)	Ex1(copy_scalar_,io,u64,e)
+#define copy_sword_11(e,io,seq)	Ex1(copy_scalar_,io,i32,e)
+#define copy_word_11(e,io,seq)	Ex1(copy_scalar_,io,u32,e)
+#define copy_sxword_11(e,io,seq)Ex1(copy_scalar_,io,i64,e)
+#define copy_xword_11(e,io,seq)	Ex1(copy_scalar_,io,u64,e)
+
+/*
+ * structure copying (direction independent)
+ * these macros are used as `copy' arguments to copy_type()
+ */
+#define copy_dyn_11(e,io,seq)		\
+    seq(copy_xword(e,io,d_tag),		\
+    seq(copy_addr(e,io,d_un.d_ptr),	\
+    nullcopy))
+#define copy_ehdr_11(e,io,seq)		\
+    seq(copy_arr(e,io,e_ident),		\
+    seq(copy_half(e,io,e_type),		\
+    seq(copy_half(e,io,e_machine),	\
+    seq(copy_word(e,io,e_version),	\
+    seq(copy_addr(e,io,e_entry),	\
+    seq(copy_off(e,io,e_phoff),		\
+    seq(copy_off(e,io,e_shoff),		\
+    seq(copy_word(e,io,e_flags),	\
+    seq(copy_half(e,io,e_ehsize),	\
+    seq(copy_half(e,io,e_phentsize),	\
+    seq(copy_half(e,io,e_phnum),	\
+    seq(copy_half(e,io,e_shentsize),	\
+    seq(copy_half(e,io,e_shnum),	\
+    seq(copy_half(e,io,e_shstrndx),	\
+    nullcopy))))))))))))))
+#define copy_phdr_11(e,io,seq)		\
+    seq(copy_word(e,io,p_type),		\
+    seq(copy_word(e,io,p_flags),	\
+    seq(copy_off(e,io,p_offset),	\
+    seq(copy_addr(e,io,p_vaddr),	\
+    seq(copy_addr(e,io,p_paddr),	\
+    seq(copy_xword(e,io,p_filesz),	\
+    seq(copy_xword(e,io,p_memsz),	\
+    seq(copy_xword(e,io,p_align),	\
+    nullcopy))))))))
+#if __LIBELF64_IRIX
+#define copy_rela_11(e,io,seq)		\
+    seq(copy_addr(e,io,r_offset),	\
+    seq(copy_word(e,io,r_sym),		\
+    seq(copy_byte(e,io,r_ssym),		\
+    seq(copy_byte(e,io,r_type3),	\
+    seq(copy_byte(e,io,r_type2),	\
+    seq(copy_byte(e,io,r_type),		\
+    seq(copy_sxword(e,io,r_addend),	\
+    nullcopy)))))))
+#define copy_rel_11(e,io,seq)		\
+    seq(copy_addr(e,io,r_offset),	\
+    seq(copy_word(e,io,r_sym),		\
+    seq(copy_byte(e,io,r_ssym),		\
+    seq(copy_byte(e,io,r_type3),	\
+    seq(copy_byte(e,io,r_type2),	\
+    seq(copy_byte(e,io,r_type),		\
+    nullcopy))))))
+#else /* __LIBELF64_IRIX */
+#define copy_rela_11(e,io,seq)		\
+    seq(copy_addr(e,io,r_offset),	\
+    seq(copy_xword(e,io,r_info),	\
+    seq(copy_sxword(e,io,r_addend),	\
+    nullcopy)))
+#define copy_rel_11(e,io,seq)		\
+    seq(copy_addr(e,io,r_offset),	\
+    seq(copy_xword(e,io,r_info),	\
+    nullcopy))
+#endif /* __LIBELF64_IRIX */
+#define copy_shdr_11(e,io,seq)		\
+    seq(copy_word(e,io,sh_name),	\
+    seq(copy_word(e,io,sh_type),	\
+    seq(copy_xword(e,io,sh_flags),	\
+    seq(copy_addr(e,io,sh_addr),	\
+    seq(copy_off(e,io,sh_offset),	\
+    seq(copy_xword(e,io,sh_size),	\
+    seq(copy_word(e,io,sh_link),	\
+    seq(copy_word(e,io,sh_info),	\
+    seq(copy_xword(e,io,sh_addralign),	\
+    seq(copy_xword(e,io,sh_entsize),	\
+    nullcopy))))))))))
+#define copy_sym_11(e,io,seq)		\
+    seq(copy_word(e,io,st_name),	\
+    seq(copy_byte(e,io,st_info),	\
+    seq(copy_byte(e,io,st_other),	\
+    seq(copy_half(e,io,st_shndx),	\
+    seq(copy_addr(e,io,st_value),	\
+    seq(copy_xword(e,io,st_size),	\
+    nullcopy))))))
+
+#define nullcopy /**/
+
+static size_t
+byte_copy(unsigned char *dst, const unsigned char *src, size_t n) {
+    if (n && dst && dst != src) {
+#if HAVE_BROKEN_MEMMOVE
+	size_t i;
+
+	if (dst >= src + n || dst + n <= src) {
+	    memcpy(dst, src, n);
+	}
+	else if (dst < src) {
+	    for (i = 0; i < n; i++) {
+		dst[i] = src[i];
+	    }
+	}
+	else {
+	    for (i = n; --i; ) {
+		dst[i] = src[i];
+	    }
+	}
+#else /* HAVE_BROKEN_MEMMOVE */
+	memmove(dst, src, n);
+#endif /* HAVE_BROKEN_MEMMOVE */
+    }
+    return n;
+}
+
+static void
+array_copy(unsigned char *dst, size_t dlen, const unsigned char *src, size_t slen) {
+    byte_copy(dst, src, dlen < slen ? dlen : slen);
+    if (dlen > slen) {
+	memset(dst + slen, 0, dlen - slen);
+    }
+}
+
+/*
+ * instantiate copy functions
+ */
+copy_type(addr_64,_,Elf64_Addr,copy_addr_11)
+copy_type(half_64,_,Elf64_Half,copy_half_11)
+copy_type(off_64,_,Elf64_Off,copy_off_11)
+copy_type(sword_64,_,Elf64_Sword,copy_sword_11)
+copy_type(word_64,_,Elf64_Word,copy_word_11)
+copy_type(sxword_64,_,Elf64_Sxword,copy_sxword_11)
+copy_type(xword_64,_,Elf64_Xword,copy_xword_11)
+copy_type(dyn_64,11,Elf64_Dyn,copy_dyn_11)
+copy_type(ehdr_64,11,Elf64_Ehdr,copy_ehdr_11)
+copy_type(phdr_64,11,Elf64_Phdr,copy_phdr_11)
+copy_type(rela_64,11,Elf64_Rela,copy_rela_11)
+copy_type(rel_64,11,Elf64_Rel,copy_rel_11)
+copy_type(shdr_64,11,Elf64_Shdr,copy_shdr_11)
+copy_type(sym_64,11,Elf64_Sym,copy_sym_11)
+
+typedef size_t (*xlator)(unsigned char*, const unsigned char*, size_t);
+typedef xlator xltab[ELF_T_NUM][2];
+
+/*
+ * translation table (64-bit, version 1 -> version 1)
+ */
+#if PIC
+static xltab
+#else /* PIC */
+static const xltab
+#endif /* PIC */
+xlate64_11[/*encoding*/] = {
+    {
+	{ byte_copy,        byte_copy       },
+	{ addr_64L__tom,    addr_64L__tof   },
+	{ dyn_64L11_tom,    dyn_64L11_tof   },
+	{ ehdr_64L11_tom,   ehdr_64L11_tof  },
+	{ half_64L__tom,    half_64L__tof   },
+	{ off_64L__tom,     off_64L__tof    },
+	{ phdr_64L11_tom,   phdr_64L11_tof  },
+	{ rela_64L11_tom,   rela_64L11_tof  },
+	{ rel_64L11_tom,    rel_64L11_tof   },
+	{ shdr_64L11_tom,   shdr_64L11_tof  },
+	{ sword_64L__tom,   sword_64L__tof  },
+	{ sym_64L11_tom,    sym_64L11_tof   },
+	{ word_64L__tom,    word_64L__tof   },
+	{ sxword_64L__tom,  sxword_64L__tof },
+	{ xword_64L__tom,   xword_64L__tof  },
+#if __LIBELF_SYMBOL_VERSIONS
+	{ _elf_verdef_64L11_tom,  _elf_verdef_64L11_tof  },
+	{ _elf_verneed_64L11_tom, _elf_verneed_64L11_tof },
+#else /* __LIBELF_SYMBOL_VERSIONS */
+	{ 0,                0               },
+	{ 0,                0               },
+#endif /* __LIBELF_SYMBOL_VERSIONS */
+    },
+    {
+	{ byte_copy,        byte_copy       },
+	{ addr_64M__tom,    addr_64M__tof   },
+	{ dyn_64M11_tom,    dyn_64M11_tof   },
+	{ ehdr_64M11_tom,   ehdr_64M11_tof  },
+	{ half_64M__tom,    half_64M__tof   },
+	{ off_64M__tom,     off_64M__tof    },
+	{ phdr_64M11_tom,   phdr_64M11_tof  },
+	{ rela_64M11_tom,   rela_64M11_tof  },
+	{ rel_64M11_tom,    rel_64M11_tof   },
+	{ shdr_64M11_tom,   shdr_64M11_tof  },
+	{ sword_64M__tom,   sword_64M__tof  },
+	{ sym_64M11_tom,    sym_64M11_tof   },
+	{ word_64M__tom,    word_64M__tof   },
+	{ sxword_64M__tom,  sxword_64M__tof },
+	{ xword_64M__tom,   xword_64M__tof  },
+#if __LIBELF_SYMBOL_VERSIONS
+	{ _elf_verdef_64M11_tom,  _elf_verdef_64M11_tof  },
+	{ _elf_verneed_64M11_tom, _elf_verneed_64M11_tof },
+#else /* __LIBELF_SYMBOL_VERSIONS */
+	{ 0,                0               },
+	{ 0,                0               },
+#endif /* __LIBELF_SYMBOL_VERSIONS */
+    },
+};
+
+/*
+ * main translation table (64-bit)
+ */
+#if PIC
+static xltab*
+#else /* PIC */
+static const xltab *const
+#endif /* PIC */
+xlate64[EV_CURRENT - EV_NONE][EV_CURRENT - EV_NONE] = {
+    { xlate64_11, },
+};
+
+#define translator(sv,dv,enc,type,d)	\
+    (xlate64[(sv) - EV_NONE - 1]	\
+	    [(dv) - EV_NONE - 1]	\
+	    [(enc) - ELFDATA2LSB]	\
+	    [(type) - ELF_T_BYTE]	\
+	    [d])
+
+/*
+ * destination buffer size
+ */
+size_t
+_elf64_xltsize(const Elf_Data *src, unsigned dv, unsigned encode, int tof) {
+    Elf_Type type = src->d_type;
+    unsigned sv = src->d_version;
+    xlator op;
+
+    if (!valid_version(sv) || !valid_version(dv)) {
+	seterr(ERROR_UNKNOWN_VERSION);
+	return (size_t)-1;
+    }
+    if (tof) {
+	/*
+	 * Encoding doesn't really matter (the translator only looks at
+	 * the source, which resides in memory), but we need a proper
+	 * encoding to select a translator...
+	 */
+	encode = ELFDATA2LSB;
+    }
+    else if (!valid_encoding(encode)) {
+	seterr(ERROR_UNKNOWN_ENCODING);
+	return (size_t)-1;
+    }
+    if (!valid_type(type)) {
+	seterr(ERROR_UNKNOWN_TYPE);
+	return (size_t)-1;
+    }
+    if (!(op = translator(sv, dv, encode, type, tof))) {
+	seterr(ERROR_UNKNOWN_TYPE);
+	return (size_t)-1;
+    }
+    return (*op)(NULL, src->d_buf, src->d_size);
+}
+
+/*
+ * direction-independent translation
+ */
+static Elf_Data*
+elf64_xlate(Elf_Data *dst, const Elf_Data *src, unsigned encode, int tof) {
+    Elf_Type type;
+    int dv;
+    int sv;
+    size_t dsize;
+    size_t tmp;
+    xlator op;
+
+    if (!src || !dst) {
+	return NULL;
+    }
+    if (!src->d_buf || !dst->d_buf) {
+	seterr(ERROR_NULLBUF);
+	return NULL;
+    }
+    if (!valid_encoding(encode)) {
+	seterr(ERROR_UNKNOWN_ENCODING);
+	return NULL;
+    }
+    sv = src->d_version;
+    dv = dst->d_version;
+    if (!valid_version(sv) || !valid_version(dv)) {
+	seterr(ERROR_UNKNOWN_VERSION);
+	return NULL;
+    }
+    type = src->d_type;
+    if (!valid_type(type)) {
+	seterr(ERROR_UNKNOWN_TYPE);
+	return NULL;
+    }
+    op = translator(sv, dv, encode, type, tof);
+    if (!op) {
+	seterr(ERROR_UNKNOWN_TYPE);
+	return NULL;
+    }
+    dsize = (*op)(NULL, src->d_buf, src->d_size);
+    if (dsize == (size_t)-1) {
+	return NULL;
+    }
+    if (dst->d_size < dsize) {
+	seterr(ERROR_DST2SMALL);
+	return NULL;
+    }
+    if (dsize) {
+	tmp = (*op)(dst->d_buf, src->d_buf, src->d_size);
+	if (tmp == (size_t)-1) {
+	    return NULL;
+	}
+	elf_assert(tmp == dsize);
+    }
+    dst->d_size = dsize;
+    dst->d_type = type;
+    return dst;
+}
+
+/*
+ * finally, the "official" translation functions
+ */
+Elf_Data*
+elf64_xlatetom(Elf_Data *dst, const Elf_Data *src, unsigned encode) {
+    return elf64_xlate(dst, src, encode, 0);
+}
+
+Elf_Data*
+elf64_xlatetof(Elf_Data *dst, const Elf_Data *src, unsigned encode) {
+    return elf64_xlate(dst, src, encode, 1);
+}
+
+Elf_Data*
+gelf_xlatetom(Elf *elf, Elf_Data *dst, const Elf_Data *src, unsigned encode) {
+    if (elf) {
+	if (elf->e_kind != ELF_K_ELF) {
+	    seterr(ERROR_NOTELF);
+	}
+	else if (elf->e_class == ELFCLASS32) {
+	    return elf32_xlatetom(dst, src, encode);
+	}
+	else if (elf->e_class == ELFCLASS64) {
+	    return elf64_xlatetom(dst, src, encode);
+	}
+	else if (valid_class(elf->e_class)) {
+	    seterr(ERROR_UNIMPLEMENTED);
+	}
+	else {
+	    seterr(ERROR_UNKNOWN_CLASS);
+	}
+    }
+    return NULL;
+}
+
+Elf_Data*
+gelf_xlatetof(Elf *elf, Elf_Data *dst, const Elf_Data *src, unsigned encode) {
+    if (elf) {
+	if (elf->e_kind != ELF_K_ELF) {
+	    seterr(ERROR_NOTELF);
+	}
+	else if (elf->e_class == ELFCLASS32) {
+	    return elf32_xlatetof(dst, src, encode);
+	}
+	else if (elf->e_class == ELFCLASS64) {
+	    return elf64_xlatetof(dst, src, encode);
+	}
+	else if (valid_class(elf->e_class)) {
+	    seterr(ERROR_UNIMPLEMENTED);
+	}
+	else {
+	    seterr(ERROR_UNKNOWN_CLASS);
+	}
+    }
+    return NULL;
+}
+
+#endif /* __LIBELF64__ */

+ 278 - 0
lib/libelf/lib/Makefile.in

@@ -0,0 +1,278 @@
+# lib/Makefile for libelf.
+# Copyright (C) 1995 - 2009 Michael Riepe
+# 
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+# 
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Library General Public License for more details.
+# 
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+# @(#) $Id: Makefile.in,v 1.40 2009/11/01 13:04:19 michael Exp $
+
+instroot =
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+libdir = @libdir@
+includedir = @includedir@
+installdirs = $(libdir) $(includedir) $(includedir)/libelf
+
+CC = @CC@
+LD = @LD@
+AR = ar
+MV = mv -f
+RM = rm -f
+LN_S = @LN_S@
+RANLIB = @RANLIB@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+DEFS = -DHAVE_CONFIG_H
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+DEPSHLIBS = @DEPSHLIBS@
+
+DO_SHLIB = @DO_SHLIB@
+PICFLAGS = @PICFLAGS@
+SHLIB_SFX = @SHLIB_SFX@
+SHLINK_SFX = @SHLINK_SFX@
+SONAME_SFX = @SONAME_SFX@
+LINK_SHLIB = @LINK_SHLIB@
+INSTALL_SHLIB = @INSTALL_SHLIB@
+
+SHLIB = libelf$(SHLIB_SFX)
+SHLINK = libelf$(SHLINK_SFX)
+SONAME = libelf$(SONAME_SFX)
+
+# install includes in includedir?
+DO_COMPAT = @DO_COMPAT@
+
+COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
+
+# no user serviceable parts below
+
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+MAJOR = @MAJOR@
+
+SHELL = /bin/sh
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+
+topdir = ..
+subdir = lib
+
+.SUFFIXES:
+.SUFFIXES: .c .o
+.c.o:
+	@$(RM) $@ $(@:.o=.os)
+	if test -n "$(PICFLAGS)"; then \
+	  $(COMPILE) $(PICFLAGS) $< && $(MV) $@ $(@:.o=.os); \
+	else true; fi
+	$(COMPILE) $<
+
+INCLUDES = -I$(topdir) -I. -I$(srcdir)
+
+# generic sources
+SRCS1 = begin.c cntl.c end.c errmsg.c errno.c fill.c flag.c getarhdr.c \
+	getarsym.c getbase.c getdata.c getident.c getscn.c hash.c kind.c \
+	ndxscn.c newdata.c newscn.c next.c nextscn.c rand.c rawdata.c \
+	rawfile.c strptr.c update.c version.c checksum.c getaroff.c
+OBJS1 = begin.o cntl.o end.o errmsg.o errno.o fill.o flag.o getarhdr.o \
+	getarsym.o getbase.o getdata.o getident.o getscn.o hash.o kind.o \
+	ndxscn.o newdata.o newscn.o next.o nextscn.o rand.o rawdata.o \
+	rawfile.o strptr.o update.o version.o checksum.o getaroff.o
+
+# 32-bit sources
+SRCS2 = 32.fsize.c 32.getehdr.c 32.getphdr.c 32.getshdr.c 32.newehdr.c \
+	32.newphdr.c 32.xlatetof.c
+OBJS2 = 32.fsize.o 32.getehdr.o 32.getphdr.o 32.getshdr.o 32.newehdr.o \
+	32.newphdr.o 32.xlatetof.o
+
+# support
+SRCS3 = cook.c data.c input.c assert.c
+OBJS3 = cook.o data.o input.o assert.o
+
+# nlist
+SRCS4 = nlist.c
+OBJS4 = nlist.o
+
+# opt
+SRCS5 = opt.delscn.c x.remscn.c x.movscn.c x.elfext.c
+OBJS5 = opt.delscn.o x.remscn.o x.movscn.o x.elfext.o
+
+# 64-bit sources
+SRCS64 = 64.xlatetof.c gelfehdr.c gelfphdr.c gelfshdr.c gelftrans.c swap64.c
+OBJS64 = 64.xlatetof.o gelfehdr.o gelfphdr.o gelfshdr.o gelftrans.o swap64.o
+
+# Versioning sources
+SRCS_V = verdef_32_tof.c verdef_32_tom.c verdef_64_tof.c verdef_64_tom.c
+OBJS_V = verdef_32_tof.o verdef_32_tom.o verdef_64_tof.o verdef_64_tom.o
+HDRS_V = verdef.h verneed.h
+
+SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) $(SRCS64) $(SRCS_V)
+OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) $(OBJS64) $(OBJS_V)
+
+# missing functions
+LIBSRCS = memset.c
+LIBOBJS = @LIBOBJS@
+
+# public header files
+HDRS = libelf.h nlist.h gelf.h
+
+# public header files (created by configure)
+AUXHDRS = sys_elf.h
+
+# private header files
+PRIVHDRS = byteswap.h errors.h ext_types.h private.h elf_repl.h \
+	$(HDRS_V)
+
+DISTFILES = $(SRCS) $(LIBSRCS) $(HDRS) $(PRIVHDRS) Makefile.in sys_elf.h.in \
+    Makefile.w32 build.bat config.h.w32 libelf.def sys_elf.h.w32
+
+all: libelf.a shared-$(DO_SHLIB)
+
+check:
+
+shared-yes: $(SHLIB)
+shared-no:
+
+libelf.a: $(OBJS) $(LIBOBJS)
+	@$(RM) $@
+	$(AR) rcv $@ $(OBJS) $(LIBOBJS)
+	$(RANLIB) $@
+
+$(SHLIB): libelf.a
+	@$(RM) $(SHLIB)
+	$(LINK_SHLIB) -o $(SHLIB) $(OBJS:.o=.os) $(LIBOBJS:.o=.os) $(DEPSHLIBS)
+	if test "$(SONAME)" = "$(SHLIB)"; then true; else \
+	  $(RM) $(SONAME) && $(LN_S) $(SHLIB) $(SONAME); \
+	fi
+	if test "$(SHLINK)" = "$(SHLIB)"; then true; else \
+	  $(RM) $(SHLINK) && $(LN_S) $(SHLIB) $(SHLINK); \
+	fi
+
+install: install-data \
+	install-shared-$(DO_SHLIB) install-compat-$(DO_COMPAT)
+
+installdirs: $(top_srcdir)/mkinstalldirs
+	dirs="$(installdirs)"; for dir in $$dirs; do \
+	    $(SHELL) $(top_srcdir)/mkinstalldirs $(instroot)$$dir; \
+	done
+
+install-data: all installdirs
+	$(INSTALL_DATA) libelf.a $(instroot)$(libdir)
+	-cd $(instroot)$(libdir) && $(RANLIB) libelf.a
+	files="$(HDRS) $(AUXHDRS) elf_repl.h"; for file in $$files; do \
+	  if test -r $$file; then \
+	    $(INSTALL_DATA) $$file $(instroot)$(includedir)/libelf; \
+	  else \
+	    $(INSTALL_DATA) $(srcdir)/$$file $(instroot)$(includedir)/libelf; \
+	  fi; \
+	done
+
+uninstall: uninstall-data \
+	uninstall-shared-$(DO_SHLIB) uninstall-compat-$(DO_COMPAT)
+
+uninstall-data:
+	$(RM) $(instroot)$(libdir)/libelf.a
+	$(RM) -r $(instroot)$(includedir)/libelf
+
+install-shared-yes: install-shared
+install-shared-no:
+install-shared: installdirs $(SHLIB)
+	$(INSTALL_SHLIB) $(SHLIB) $(instroot)$(libdir)
+	if test "$(SONAME)" = "$(SHLIB)"; then true; else \
+	  cd $(instroot)$(libdir) && $(RM) $(SONAME) && $(LN_S) $(SHLIB) $(SONAME); \
+	fi
+	if test "$(SHLINK)" = "$(SHLIB)"; then true; else \
+	  cd $(instroot)$(libdir) && $(RM) $(SHLINK) && $(LN_S) $(SHLIB) $(SHLINK); \
+	fi
+
+uninstall-shared-yes: uninstall-shared
+uninstall-shared-no:
+uninstall-shared:
+	cd $(instroot)$(libdir) && $(RM) $(SHLIB) $(SONAME) $(SHLINK)
+
+install-compat-yes: install-compat
+install-compat-no:
+install-compat: installdirs
+	files="$(HDRS)"; for file in $$files; do \
+	  if test -f $(instroot)$(includedir)/$$file; then true; else \
+	    echo "#include <libelf/$$file>" > $(instroot)$(includedir)/$$file; \
+	  fi; \
+	done
+
+uninstall-compat-yes: uninstall-compat
+uninstall-compat-no:
+uninstall-compat:
+	files="$(HDRS)"; for file in $$files; do \
+	  if grep "^#include <libelf/$$file>\$$" $(instroot)$(includedir)/$$file >/dev/null 2>&1; then \
+	    $(RM) $(instroot)$(includedir)/$$file; \
+	  else true; fi; \
+	done
+
+mostlyclean:
+	$(RM) *.o *.a *.os $(SHLIB) $(SONAME) $(SHLINK)
+	$(RM) *~ core a.out errlist
+
+clean: mostlyclean
+
+distclean: clean
+	$(RM) stamp-h $(AUXHDRS)
+	$(RM) Makefile
+
+maintainer-clean: distclean
+
+# maintainer only
+
+MAINT = @MAINT@
+
+distdir = $(PACKAGE)-$(VERSION)
+distsubdir = $(topdir)/$(distdir)/$(subdir)
+$(MAINT)dist: $(DISTFILES)
+	if test -d $(distsubdir); then true; else mkdir $(distsubdir); fi
+	files="$(DISTFILES)"; for file in $$files; do \
+	  ln $(srcdir)/$$file $(distsubdir) || \
+	    cp -p $(srcdir)/$$file $(distsubdir) || exit 1; \
+	done
+
+# For the justification of the following Makefile rules, see node
+# `Automatic Remaking' in GNU Autoconf documentation.
+
+$(MAINT)Makefile: Makefile.in $(topdir)/config.status
+	cd $(topdir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status
+
+$(MAINT)sys_elf.h: stamp-h
+$(MAINT)stamp-h: sys_elf.h.in $(topdir)/config.status
+	cd $(topdir) && CONFIG_FILES= CONFIG_HEADERS=$(subdir)/sys_elf.h ./config.status
+	$(RM) stamp-h && echo timestamp > stamp-h
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
+
+# dependencies
+$(OBJS): private.h $(topdir)/config.h libelf.h gelf.h errors.h $(AUXHDRS)
+32.fsize.o: ext_types.h
+32.xlatetof.o: byteswap.h ext_types.h
+64.xlatetof.o: byteswap.h ext_types.h
+getarsym.o: byteswap.h
+memset.o: $(topdir)/config.h
+nlist.o: nlist.h
+swap64.o: byteswap.h
+$(OBJS_V): byteswap.h ext_types.h $(HDRS_V)

+ 166 - 0
lib/libelf/lib/Makefile.w32

@@ -0,0 +1,166 @@
+# lib/Makefile.w32 - Makefile for W32 port.
+# Copyright (C) 1995 - 2009 Michael Riepe
+# 
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+# 
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Library General Public License for more details.
+# 
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+# @(#) $Id: Makefile.w32,v 1.3 2009/11/01 13:04:19 michael Exp $
+
+instroot =
+
+prefix = 
+exec_prefix = 
+libdir = 
+includedir = 
+installdirs = $(libdir) $(includedir) $(includedir)/libelf
+
+CC = cl /nologo
+LD = link /nologo
+AR = 
+MV = 
+RM = del
+LN_S = 
+RANLIB = 
+INSTALL = 
+INSTALL_DATA = 
+INSTALL_PROGRAM = 
+
+CFLAGS = /O2 /W2 /TC /MD
+CPPFLAGS = 
+DEFS = /DHAVE_CONFIG_H
+LDFLAGS = 
+LIBS = 
+DEPSHLIBS = 
+
+DO_SHLIB = 
+PICFLAGS = 
+SHLIB_SFX = .dll
+SHLINK_SFX = 
+SONAME_SFX = 
+LINK_SHLIB = $(LD) /DLL $(LDFLAGS)
+
+SHLIB = libelf$(SHLIB_SFX)
+SHLINK = libelf$(SHLINK_SFX)
+SONAME = libelf$(SONAME_SFX)
+
+# install includes in includedir?
+DO_COMPAT = 
+
+INCLUDES = /I.
+
+COMPILE = $(CC) /c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
+
+# no user serviceable parts below
+
+PACKAGE = libelf
+VERSION = 0.8.9
+MAJOR = 0
+
+SHELL = /bin/sh
+
+srcdir = .
+top_srcdir = ..
+
+topdir = ..
+subdir = lib
+
+.SUFFIXES:
+.SUFFIXES: .obj .c
+.c.obj:
+	$(COMPILE) $<
+
+# generic sources
+SRCS1 = begin.c cntl.c end.c errmsg.c errno.c fill.c flag.c getarhdr.c \
+	getarsym.c getbase.c getdata.c getident.c getscn.c hash.c kind.c \
+	ndxscn.c newdata.c newscn.c next.c nextscn.c rand.c rawdata.c \
+	rawfile.c strptr.c update.c version.c checksum.c getaroff.c
+OBJS1 = $(SRCS1:.c=.obj)
+
+# 32-bit sources
+SRCS2 = 32.fsize.c 32.getehdr.c 32.getphdr.c 32.getshdr.c 32.newehdr.c \
+	32.newphdr.c 32.xlatetof.c
+OBJS2 = $(SRCS2:.c=.obj)
+
+# support
+SRCS3 = cook.c data.c input.c assert.c
+OBJS3 = $(SRCS3:.c=.obj)
+
+# nlist
+SRCS4 = nlist.c
+OBJS4 = $(SRCS4:.c=.obj)
+
+# opt
+SRCS5 = opt.delscn.c x.remscn.c x.movscn.c x.elfext.c
+OBJS5 = $(SRCS5:.c=.obj)
+
+# 64-bit sources
+SRCS64 = 64.xlatetof.c gelfehdr.c gelfphdr.c gelfshdr.c gelftrans.c swap64.c
+OBJS64 = $(SRCS64:.c=.obj)
+
+# Versioning sources
+SRCS_V = verdef_32_tof.c verdef_32_tom.c verdef_64_tof.c verdef_64_tom.c
+OBJS_V = $(SRCS_V:.c=.obj)
+HDRS_V = verdef.h verneed.h
+
+SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) $(SRCS64) $(SRCS_V)
+OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) $(OBJS64) $(OBJS_V)
+
+# missing functions
+LIBSRCS = memset.c
+LIBOBJS = 
+
+# public header files
+HDRS = libelf.h nlist.h gelf.h
+
+# public header files (created by configure)
+AUXHDRS = sys_elf.h
+
+# private header files
+PRIVHDRS = byteswap.h errors.h ext_types.h private.h elf_repl.h $(HDRS_V)
+
+DISTFILES = $(SRCS) $(LIBSRCS) $(HDRS) $(PRIVHDRS) Makefile.in sys_elf.h.in
+
+all: $(OBJS) $(SHLIB)
+
+check:
+
+$(SHLIB): libelf.def $(OBJS) $(LIBOBJS)
+	-@$(RM) $(SHLIB)
+	$(LINK_SHLIB) /OUT:"$(SHLIB)" /DEF:"libelf.def" $(OBJS) $(LIBOBJS) kernel32.lib
+
+install:
+
+mostlyclean:
+	-$(RM) *.obj
+	-$(RM) $(SHLIB)
+	-$(RM) libelf.lib
+	-$(RM) libelf.exp
+
+clean: mostlyclean
+
+distclean: clean
+	-$(RM) $(AUXHDRS)
+
+maintainer-clean: distclean
+
+# dependencies
+$(OBJS): private.h config.h libelf.h gelf.h errors.h $(AUXHDRS)
+32.fsize.obj: ext_types.h
+32.xlatetof.obj: byteswap.h ext_types.h
+64.xlatetof.obj: byteswap.h ext_types.h
+getarsym.obj: byteswap.h
+memset.obj: config.h
+nlist.obj: nlist.h
+swap64.obj: byteswap.h
+$(OBJS_V): byteswap.h ext_types.h $(HDRS_V)

+ 33 - 0
lib/libelf/lib/assert.c

@@ -0,0 +1,33 @@
+/*
+assert.c - assert function for libelf.
+Copyright (C) 1999 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: assert.c,v 1.5 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+#include <stdio.h>
+
+void
+__elf_assert(const char *file, unsigned line, const char *cond) {
+    fprintf(stderr, "%s:%u: libelf assertion failure: %s\n",
+	    file, line, cond);
+    abort();
+}

+ 429 - 0
lib/libelf/lib/begin.c

@@ -0,0 +1,429 @@
+/*
+ * begin.c - implementation of the elf_begin(3) and elf_memory(3) functions.
+ * Copyright (C) 1995 - 2004 Michael Riepe
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: begin.c,v 1.22 2009/11/01 13:04:19 michael Exp $";
+#endif /* lint */
+
+static const Elf _elf_init = INIT_ELF;
+static const char fmag[] = ARFMAG;
+
+static unsigned long
+getnum(const char *str, size_t len, int base, size_t *err) {
+    unsigned long result = 0;
+
+    while (len && *str == ' ') {
+	str++; len--;
+    }
+    while (len && *str >= '0' && (*str - '0') < base) {
+	result = base * result + *str++ - '0'; len--;
+    }
+    while (len && *str == ' ') {
+	str++; len--;
+    }
+    if (len) {
+	*err = len;
+    }
+    return result;
+}
+
+static void
+_elf_init_ar(Elf *elf) {
+    struct ar_hdr *hdr;
+    size_t offset;
+    size_t size;
+    size_t err = 0;
+
+    elf->e_kind = ELF_K_AR;
+    elf->e_idlen = SARMAG;
+    elf->e_off = SARMAG;
+
+    /* process special members */
+    offset = SARMAG;
+    while (!elf->e_strtab && offset + sizeof(*hdr) <= elf->e_size) {
+	hdr = (struct ar_hdr*)(elf->e_data + offset);
+	if (memcmp(hdr->ar_fmag, fmag, sizeof(fmag) - 1)) {
+	    break;
+	}
+	if (hdr->ar_name[0] != '/') {
+	    break;
+	}
+	size = getnum(hdr->ar_size, sizeof(hdr->ar_size), 10, &err);
+	if (err || !size) {
+	    break;
+	}
+	offset += sizeof(*hdr);
+	if (offset + size > elf->e_size) {
+	    break;
+	}
+	if (hdr->ar_name[1] == '/' && hdr->ar_name[2] == ' ') {
+	    elf->e_strtab = elf->e_data + offset;
+	    elf->e_strlen = size;
+	    break;
+	}
+	if (hdr->ar_name[1] != ' ') {
+	    break;
+	}
+	/*
+	 * Windows (.lib) archives provide two symbol tables
+	 * The first one is the one we want.
+	 */
+	if (!elf->e_symtab) {
+	    elf->e_symtab = elf->e_data + offset;
+	    elf->e_symlen = size;
+	}
+	offset += size + (size & 1);
+    }
+}
+
+static Elf_Arhdr*
+_elf_arhdr(Elf *arf) {
+    struct ar_hdr *hdr;
+    Elf_Arhdr *arhdr;
+    size_t namelen;
+    size_t tmp;
+    char *name;
+    size_t err = 0;
+
+    if (arf->e_off == arf->e_size) {
+	/* no error! */
+	return NULL;
+    }
+    if (arf->e_off < 0 || arf->e_off > arf->e_size) {
+	seterr(ERROR_OUTSIDE);
+	return NULL;
+    }
+    if (arf->e_off + sizeof(*hdr) > arf->e_size) {
+	seterr(ERROR_TRUNC_ARHDR);
+	return NULL;
+    }
+    elf_assert(arf->e_data != NULL);
+    hdr = (struct ar_hdr*)(arf->e_data + arf->e_off);
+    if (memcmp(hdr->ar_fmag, fmag, sizeof(fmag) - 1)) {
+	seterr(ERROR_ARFMAG);
+	return NULL;
+    }
+
+    name = hdr->ar_name;
+    for (namelen = sizeof(hdr->ar_name); namelen > 0; namelen--) {
+	if (name[namelen - 1] != ' ') {
+	    break;
+	}
+    }
+    if (name[0] == '/') {
+	if (name[1] >= '0' && name[1] <= '9') {
+	    if (!arf->e_strtab) {
+		seterr(ERROR_ARSTRTAB);
+		return NULL;
+	    }
+	    tmp = getnum(&name[1], namelen - 1, 10, &err);
+	    if (err) {
+		seterr(ERROR_ARSPECIAL);
+		return NULL;
+	    }
+	    if (tmp < 0 || tmp >= arf->e_strlen) {
+		seterr(ERROR_ARSTRTAB);
+		return NULL;
+	    }
+	    for (namelen = tmp; namelen < arf->e_strlen; namelen++) {
+		if (arf->e_strtab[namelen] == '/') {
+		    break;
+		}
+	    }
+	    if (namelen == arf->e_strlen) {
+		seterr(ERROR_ARSTRTAB);
+		return NULL;
+	    }
+	    name = arf->e_strtab + tmp;
+	    namelen -= tmp;
+	}
+	else if (namelen != 1 && !(namelen == 2 && name[1] == '/')) {
+	    seterr(ERROR_ARSPECIAL);
+	    return NULL;
+	}
+    }
+    else if (namelen > 0 && name[namelen - 1] == '/') {
+	namelen--;
+    }
+    /* XXX some broken software omits the trailing slash
+    else {
+	namelen = 0;
+    }
+    */
+
+    if (!(arhdr = (Elf_Arhdr*)malloc(sizeof(*arhdr) +
+		     sizeof(hdr->ar_name) + namelen + 2))) {
+	seterr(ERROR_MEM_ARHDR);
+	return NULL;
+    }
+
+    arhdr->ar_name = NULL;
+    arhdr->ar_rawname = (char*)(arhdr + 1);
+    arhdr->ar_date = getnum(hdr->ar_date, sizeof(hdr->ar_date), 10, &err);
+    arhdr->ar_uid = getnum(hdr->ar_uid, sizeof(hdr->ar_uid), 10, &err);
+    arhdr->ar_gid = getnum(hdr->ar_gid, sizeof(hdr->ar_gid), 10, &err);
+    arhdr->ar_mode = getnum(hdr->ar_mode, sizeof(hdr->ar_mode), 8, &err);
+    arhdr->ar_size = getnum(hdr->ar_size, sizeof(hdr->ar_size), 10, &err);
+    if (err) {
+	free(arhdr);
+	seterr(ERROR_ARHDR);
+	return NULL;
+    }
+    if (arf->e_off + sizeof(struct ar_hdr) + arhdr->ar_size > arf->e_size) {
+	free(arhdr);
+	seterr(ERROR_TRUNC_MEMBER);
+	return NULL;
+    }
+
+    memcpy(arhdr->ar_rawname, hdr->ar_name, sizeof(hdr->ar_name));
+    arhdr->ar_rawname[sizeof(hdr->ar_name)] = '\0';
+
+    if (namelen) {
+	arhdr->ar_name = arhdr->ar_rawname + sizeof(hdr->ar_name) + 1;
+	memcpy(arhdr->ar_name, name, namelen);
+	arhdr->ar_name[namelen] = '\0';
+    }
+
+    return arhdr;
+}
+
+static void
+_elf_check_type(Elf *elf, size_t size) {
+    elf->e_idlen = size;
+    if (size >= EI_NIDENT && !memcmp(elf->e_data, ELFMAG, SELFMAG)) {
+	elf->e_kind = ELF_K_ELF;
+	elf->e_idlen = EI_NIDENT;
+	elf->e_class = elf->e_data[EI_CLASS];
+	elf->e_encoding = elf->e_data[EI_DATA];
+	elf->e_version = elf->e_data[EI_VERSION];
+    }
+    else if (size >= SARMAG && !memcmp(elf->e_data, ARMAG, SARMAG)) {
+	_elf_init_ar(elf);
+    }
+}
+
+Elf*
+elf_begin(int fd, Elf_Cmd cmd, Elf *ref) {
+    Elf_Arhdr *arhdr = NULL;
+    size_t size = 0;
+    off_t off;
+    Elf *elf;
+
+    elf_assert(_elf_init.e_magic == ELF_MAGIC);
+    if (_elf_version == EV_NONE) {
+	seterr(ERROR_VERSION_UNSET);
+	return NULL;
+    }
+    else if (cmd == ELF_C_NULL) {
+	return NULL;
+    }
+    else if (cmd == ELF_C_WRITE) {
+	ref = NULL;
+    }
+    else if (cmd != ELF_C_READ && cmd != ELF_C_RDWR) {
+	seterr(ERROR_INVALID_CMD);
+	return NULL;
+    }
+    else if (ref) {
+	elf_assert(ref->e_magic == ELF_MAGIC);
+	if (!ref->e_readable || (cmd == ELF_C_RDWR && !ref->e_writable)) {
+	    seterr(ERROR_CMDMISMATCH);
+	    return NULL;
+	}
+	if (ref->e_kind != ELF_K_AR) {
+	    ref->e_count++;
+	    return ref;
+	}
+	if (cmd == ELF_C_RDWR) {
+	    seterr(ERROR_MEMBERWRITE);
+	    return NULL;
+	}
+	if (ref->e_memory) {
+	    fd = ref->e_fd;
+	}
+	else if (fd != ref->e_fd) {
+	    seterr(ERROR_FDMISMATCH);
+	    return NULL;
+	}
+	if (!(arhdr = _elf_arhdr(ref))) {
+	    return NULL;
+	}
+	size = arhdr->ar_size;
+    }
+    else if ((off = lseek(fd, (off_t)0, SEEK_END)) == (off_t)-1
+	  || (off_t)(size = off) != off) {
+	seterr(ERROR_IO_GETSIZE);
+	return NULL;
+    }
+
+    if (!(elf = (Elf*)malloc(sizeof(Elf)))) {
+	seterr(ERROR_MEM_ELF);
+	return NULL;
+    }
+    *elf = _elf_init;
+    elf->e_fd = fd;
+    elf->e_parent = ref;
+    elf->e_size = elf->e_dsize = size;
+
+    if (cmd != ELF_C_READ) {
+	elf->e_writable = 1;
+    }
+    if (cmd != ELF_C_WRITE) {
+	elf->e_readable = 1;
+    }
+    else {
+	return elf;
+    }
+
+    if (ref) {
+	size_t offset = ref->e_off + sizeof(struct ar_hdr);
+	Elf *xelf;
+
+	elf_assert(arhdr);
+	elf->e_arhdr = arhdr;
+	elf->e_base = ref->e_base + offset;
+	/*
+	 * Share the archive's memory image. To avoid
+	 * multiple independent elf descriptors if the
+	 * same member is requested twice, scan the list
+	 * of open members for duplicates.
+	 *
+	 * I don't know how SVR4 handles this case. Don't rely on it.
+	 */
+	for (xelf = ref->e_members; xelf; xelf = xelf->e_link) {
+	    elf_assert(xelf->e_parent == ref);
+	    if (xelf->e_base == elf->e_base) {
+		free(arhdr);
+		free(elf);
+		xelf->e_count++;
+		return xelf;
+	    }
+	}
+	if (size == 0) {
+	    elf->e_data = NULL;
+	}
+#if 1
+	else {
+	    /*
+	     * Archive members may be misaligned.  Freezing them will
+	     * cause libelf to allocate buffers for translated data,
+	     * which should be properly aligned in all cases.
+	     */
+	    elf_assert(!ref->e_cooked);
+	    elf->e_data = elf->e_rawdata = ref->e_data + offset;
+	}
+#else
+	else if (ref->e_data == ref->e_rawdata) {
+	    elf_assert(!ref->e_cooked);
+	    /*
+	     * archive is frozen - freeze member, too
+	     */
+	    elf->e_data = elf->e_rawdata = ref->e_data + offset;
+	}
+	else {
+	    elf_assert(!ref->e_memory);
+	    elf->e_data = ref->e_data + offset;
+	    /*
+	     * The member's memory image may have been modified if
+	     * the member has been processed before. Since we need the
+	     * original image, we have to re-read the archive file.
+	     * Will fail if the archive's file descriptor is disabled.
+	     */
+	    if (!ref->e_cooked) {
+		ref->e_cooked = 1;
+	    }
+	    else if (!_elf_read(ref, elf->e_data, offset, size)) {
+		free(arhdr);
+		free(elf);
+		return NULL;
+	    }
+	}
+#endif
+	elf->e_next = offset + size + (size & 1);
+	elf->e_disabled = ref->e_disabled;
+	elf->e_memory = ref->e_memory;
+	/* parent/child linking */
+	elf->e_link = ref->e_members;
+	ref->e_members = elf;
+	ref->e_count++;
+	/* Slowaris compatibility - do not rely on this! */
+	ref->e_off = elf->e_next;
+    }
+    else if (size) {
+#if HAVE_MMAP
+	/*
+	 * Using mmap on writable files will interfere with elf_update
+	 */
+	if (!elf->e_writable && (elf->e_data = _elf_mmap(elf))) {
+	    elf->e_unmap_data = 1;
+	}
+	else
+#endif /* HAVE_MMAP */
+	if (!(elf->e_data = _elf_read(elf, NULL, 0, size))) {
+	    free(elf);
+	    return NULL;
+	}
+    }
+
+    _elf_check_type(elf, size);
+    return elf;
+}
+
+Elf*
+elf_memory(char *image, size_t size) {
+    Elf *elf;
+
+    elf_assert(_elf_init.e_magic == ELF_MAGIC);
+    if (_elf_version == EV_NONE) {
+	seterr(ERROR_VERSION_UNSET);
+	return NULL;
+    }
+    else if (size == 0 || image == NULL) {
+	/* TODO: set error code? */
+	return NULL;
+    }
+
+    if (!(elf = (Elf*)malloc(sizeof(Elf)))) {
+	seterr(ERROR_MEM_ELF);
+	return NULL;
+    }
+    *elf = _elf_init;
+    elf->e_size = elf->e_dsize = size;
+    elf->e_data = elf->e_rawdata = image;
+    elf->e_readable = 1;
+    elf->e_disabled = 1;
+    elf->e_memory = 1;
+
+    _elf_check_type(elf, size);
+    return elf;
+}
+
+#if __LIBELF64
+
+int
+gelf_getclass(Elf *elf) {
+    if (elf && elf->e_kind == ELF_K_ELF && valid_class(elf->e_class)) {
+	return elf->e_class;
+    }
+    return ELFCLASSNONE;
+}
+
+#endif /* __LIBELF64 */

+ 36 - 0
lib/libelf/lib/build.bat

@@ -0,0 +1,36 @@
+@echo off
+
+rem lib/build.bat - build script for W32 port
+rem Copyright (C) 2004 - 2006 Michael Riepe
+rem
+rem This library is free software; you can redistribute it and/or
+rem modify it under the terms of the GNU Library General Public
+rem License as published by the Free Software Foundation; either
+rem version 2 of the License, or (at your option) any later version.
+rem
+rem This library is distributed in the hope that it will be useful,
+rem but WITHOUT ANY WARRANTY; without even the implied warranty of
+rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+rem Library General Public License for more details.
+rem
+rem You should have received a copy of the GNU Library General Public
+rem License along with this library; if not, write to the Free Software
+rem Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+rem @(#) $Id: build.bat,v 1.1 2006/08/21 18:03:48 michael Exp $
+
+rem *** BEGIN EDIT HERE ***
+rem Please uncomment the line that suits your system:
+rem call "C:\Program Files\Microsoft Visual Studio\VC98\bin\vcvars32.bat"
+rem call "C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat"
+rem call "C:\Programme\Microsoft Visual Studio\VC98\bin\vcvars32.bat"
+rem call "C:\Programme\Microsoft Visual Studio 8\VC\bin\vcvars32.bat"
+rem OR, if you have to set the path to the compiler directly:
+rem set PATH="C:\PATH\TO\COMPILER\BINARY;%PATH%"
+rem Of course, you'll have to enter the correct path above.
+rem You may also have to change CC (default: cl.exe) in Makefile.w32.
+rem *** END EDIT HERE ***
+
+copy config.h.w32 config.h
+copy sys_elf.h.w32 sys_elf.h
+nmake /nologo /f Makefile.w32 %1

+ 95 - 0
lib/libelf/lib/byteswap.h

@@ -0,0 +1,95 @@
+/*
+byteswap.h - functions and macros for byte swapping.
+Copyright (C) 1995 - 2001 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+/* @(#) $Id: byteswap.h,v 1.7 2008/05/23 08:15:34 michael Exp $ */
+
+#ifndef _BYTESWAP_H
+#define _BYTESWAP_H
+
+#define lu(from,i,s)	(((__libelf_u32_t)((unsigned char*)(from))[i])<<(s))
+#define li(from,i,s)	(((__libelf_i32_t)((  signed char*)(from))[i])<<(s))
+
+#define __load_u16L(from)	((__libelf_u32_t) \
+    (lu(from,1,8) | lu(from,0,0)))
+#define __load_u16M(from)	((__libelf_u32_t) \
+    (lu(from,0,8) | lu(from,1,0)))
+#define __load_i16L(from)	((__libelf_i32_t) \
+    (li(from,1,8) | lu(from,0,0)))
+#define __load_i16M(from)	((__libelf_i32_t) \
+    (li(from,0,8) | lu(from,1,0)))
+
+#define __load_u32L(from)	((__libelf_u32_t) \
+    (lu(from,3,24) | lu(from,2,16) | lu(from,1,8) | lu(from,0,0)))
+#define __load_u32M(from)	((__libelf_u32_t) \
+    (lu(from,0,24) | lu(from,1,16) | lu(from,2,8) | lu(from,3,0)))
+#define __load_i32L(from)	((__libelf_i32_t) \
+    (li(from,3,24) | lu(from,2,16) | lu(from,1,8) | lu(from,0,0)))
+#define __load_i32M(from)	((__libelf_i32_t) \
+    (li(from,0,24) | lu(from,1,16) | lu(from,2,8) | lu(from,3,0)))
+
+#define su(to,i,v,s)	(((char*)(to))[i]=((__libelf_u32_t)(v)>>(s)))
+#define si(to,i,v,s)	(((char*)(to))[i]=((__libelf_i32_t)(v)>>(s)))
+
+#define __store_u16L(to,v)	\
+    (su(to,1,v,8), su(to,0,v,0))
+#define __store_u16M(to,v)	\
+    (su(to,0,v,8), su(to,1,v,0))
+#define __store_i16L(to,v)	\
+    (si(to,1,v,8), si(to,0,v,0))
+#define __store_i16M(to,v)	\
+    (si(to,0,v,8), si(to,1,v,0))
+
+#define __store_u32L(to,v)	\
+    (su(to,3,v,24), su(to,2,v,16), su(to,1,v,8), su(to,0,v,0))
+#define __store_u32M(to,v)	\
+    (su(to,0,v,24), su(to,1,v,16), su(to,2,v,8), su(to,3,v,0))
+#define __store_i32L(to,v)	\
+    (si(to,3,v,24), si(to,2,v,16), si(to,1,v,8), si(to,0,v,0))
+#define __store_i32M(to,v)	\
+    (si(to,0,v,24), si(to,1,v,16), si(to,2,v,8), si(to,3,v,0))
+
+#if __LIBELF64
+
+/*
+ * conversion functions from swap64.c
+ */
+extern __libelf_u64_t _elf_load_u64L(const unsigned char *from);
+extern __libelf_u64_t _elf_load_u64M(const unsigned char *from);
+extern __libelf_i64_t _elf_load_i64L(const unsigned char *from);
+extern __libelf_i64_t _elf_load_i64M(const unsigned char *from);
+extern void _elf_store_u64L(unsigned char *to, __libelf_u64_t v);
+extern void _elf_store_u64M(unsigned char *to, __libelf_u64_t v);
+extern void _elf_store_i64L(unsigned char *to, __libelf_u64_t v);
+extern void _elf_store_i64M(unsigned char *to, __libelf_u64_t v);
+
+/*
+ * aliases for existing conversion code
+ */
+#define __load_u64L	_elf_load_u64L
+#define __load_u64M	_elf_load_u64M
+#define __load_i64L	_elf_load_i64L
+#define __load_i64M	_elf_load_i64M
+#define __store_u64L	_elf_store_u64L
+#define __store_u64M	_elf_store_u64M
+#define __store_i64L	_elf_store_i64L
+#define __store_i64M	_elf_store_i64M
+
+#endif /* __LIBELF64 */
+
+#endif /* _BYTESWAP_H */

+ 178 - 0
lib/libelf/lib/checksum.c

@@ -0,0 +1,178 @@
+/*
+checksum.c - implementation of the elf{32,64}_checksum(3) functions.
+Copyright (C) 1995 - 2001 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: checksum.c,v 1.7 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+/*
+ * Compatibility note:
+ *
+ * The algorithm used in {elf32,elf64,gelf}_checksum() does not seem to
+ * be documented.  I hope I got it right.  My implementation does the
+ * following:
+ *
+ *   - skip sections that do not have the SHF_ALLOC flag set
+ *   - skip sections of type SHT_NULL, SHT_NOBITS, SHT_DYNSYM and
+ *     SHT_DYNAMIC
+ *   - add all data bytes from the remaining sections, modulo 2**32
+ *   - add upper and lower half of the result
+ *   - subtract 0xffff if the result is > 0xffff
+ *   - if any error occurs, return 0L
+ */
+
+static int
+skip_section(Elf_Scn *scn, unsigned cls) {
+    if (cls == ELFCLASS32) {
+	Elf32_Shdr *shdr = &scn->s_shdr32;
+
+	if (!(shdr->sh_flags & SHF_ALLOC)) {
+	    return 1;
+	}
+	switch (shdr->sh_type) {
+	    case SHT_NULL:
+	    case SHT_NOBITS:
+	    /* Solaris seems to ignore these, too */
+	    case SHT_DYNSYM:
+	    case SHT_DYNAMIC:
+		return 1;
+	}
+    }
+#if __LIBELF64
+    else if (cls == ELFCLASS64) {
+	Elf64_Shdr *shdr = &scn->s_shdr64;
+
+	if (!(shdr->sh_flags & SHF_ALLOC)) {
+	    return 1;
+	}
+	switch (shdr->sh_type) {
+	    case SHT_NULL:
+	    case SHT_NOBITS:
+	    /* Solaris seems to ignore these, too */
+	    case SHT_DYNSYM:
+	    case SHT_DYNAMIC:
+		return 1;
+	}
+    }
+#endif /* __LIBELF64 */
+    else {
+	seterr(ERROR_UNIMPLEMENTED);
+    }
+    return 0;
+}
+
+static long
+add_bytes(unsigned char *ptr, size_t len) {
+    long csum = 0;
+
+    while (len--) {
+	csum += *ptr++;
+    }
+    return csum;
+}
+
+static long
+_elf_csum(Elf *elf) {
+    long csum = 0;
+    Elf_Data *data;
+    Elf_Scn *scn;
+
+    if (!elf->e_ehdr && !_elf_cook(elf)) {
+	/* propagate errors from _elf_cook */
+	return 0L;
+    }
+    seterr(0);
+    for (scn = elf->e_scn_1; scn; scn = scn->s_link) {
+	if (scn->s_index == SHN_UNDEF || skip_section(scn, elf->e_class)) {
+	    continue;
+	}
+	data = NULL;
+	while ((data = elf_getdata(scn, data))) {
+	    if (data->d_size) {
+		if (data->d_buf == NULL) {
+		    seterr(ERROR_NULLBUF);
+		    return 0L;
+		}
+		csum += add_bytes(data->d_buf, data->d_size);
+	    }
+	}
+    }
+    if (_elf_errno) {
+	return 0L;
+    }
+    csum = (csum & 0xffff) + ((csum >> 16) & 0xffff);
+    if (csum > 0xffff) {
+	csum -= 0xffff;
+    }
+    return csum;
+}
+
+long
+elf32_checksum(Elf *elf) {
+    if (elf) {
+	if (elf->e_kind != ELF_K_ELF) {
+	    seterr(ERROR_NOTELF);
+	}
+	else if (elf->e_class != ELFCLASS32) {
+	    seterr(ERROR_CLASSMISMATCH);
+	}
+	else {
+	    return _elf_csum(elf);
+	}
+    }
+    return 0L;
+}
+
+#if __LIBELF64
+
+long
+elf64_checksum(Elf *elf) {
+    if (elf) {
+	if (elf->e_kind != ELF_K_ELF) {
+	    seterr(ERROR_NOTELF);
+	}
+	else if (elf->e_class != ELFCLASS64) {
+	    seterr(ERROR_CLASSMISMATCH);
+	}
+	else {
+	    return _elf_csum(elf);
+	}
+    }
+    return 0L;
+}
+
+long
+gelf_checksum(Elf *elf) {
+    if (elf) {
+	if (elf->e_kind != ELF_K_ELF) {
+	    seterr(ERROR_NOTELF);
+	}
+	else if (!valid_class(elf->e_class)) {
+	    seterr(ERROR_UNKNOWN_CLASS);
+	}
+	else {
+	    return _elf_csum(elf);
+	}
+    }
+    return 0L;
+}
+
+#endif /* __LIBELF64 */

+ 71 - 0
lib/libelf/lib/cntl.c

@@ -0,0 +1,71 @@
+/*
+cntl.c - implementation of the elf_cntl(3) function.
+Copyright (C) 1995 - 1998 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: cntl.c,v 1.7 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+int
+elf_cntl(Elf *elf, Elf_Cmd cmd) {
+    Elf_Scn *scn;
+    Elf *child;
+
+    if (!elf) {
+	return -1;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    if (cmd == ELF_C_FDREAD) {
+	if (!elf->e_readable) {
+	    seterr(ERROR_WRONLY);
+	    return -1;
+	}
+    }
+    else if (cmd != ELF_C_FDDONE) {
+	seterr(ERROR_INVALID_CMD);
+	return -1;
+    }
+    if (elf->e_disabled) {
+	return 0;
+    }
+    if (elf->e_kind == ELF_K_AR) {
+	for (child = elf->e_members; child; child = child->e_link) {
+	    elf_assert(elf == child->e_parent);
+	    if (elf_cntl(child, cmd)) {
+		return -1;
+	    }
+	}
+    }
+    else if (elf->e_kind == ELF_K_ELF && cmd == ELF_C_FDREAD) {
+	if (!elf->e_ehdr && !_elf_cook(elf)) {
+	    return -1;
+	}
+	for (scn = elf->e_scn_1; scn; scn = scn->s_link) {
+	    if (scn->s_index == SHN_UNDEF || scn->s_type == SHT_NULL) {
+		continue;
+	    }
+	    else if (!elf_getdata(scn, NULL)) {
+		return -1;
+	    }
+	}
+    }
+    elf->e_disabled = 1;
+    return 0;
+}

+ 161 - 0
lib/libelf/lib/config.h.w32

@@ -0,0 +1,161 @@
+/*
+ * lib/config.h.w32 - configuration file for W32 port
+ * Copyright (C) 2004 - 2006 Michael Riepe
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * @(#) $Id: config.h.w32,v 1.2 2006/09/07 15:55:42 michael Exp $
+ */
+
+/* Define to empty if the keyword does not work.  */
+#undef const
+
+/* Define if you have a working `mmap' system call.  */
+#undef HAVE_MMAP
+
+/* Define to `long' if <sys/types.h> doesn't define.  */
+#undef off_t
+
+/* Define to `unsigned' if <sys/types.h> doesn't define.  */
+#undef size_t
+
+/* Define if you have the ANSI C header files.  */
+#define STDC_HEADERS 1
+
+/* Define if you want to include extra debugging code */
+#define ENABLE_DEBUG 1
+
+/* Define if memmove() does not copy overlapping arrays correctly */
+#undef HAVE_BROKEN_MEMMOVE
+
+/* Define if you have the catgets function. */
+#undef HAVE_CATGETS
+
+/* Define if you have the dgettext function. */
+#undef HAVE_DGETTEXT
+
+/* Define if you have the memset function.  */
+#define HAVE_MEMSET 1
+
+/* Define if struct nlist is declared in <elf.h> or <sys/elf.h> */
+#undef HAVE_STRUCT_NLIST_DECLARATION
+
+/* Define if Elf32_Dyn is declared in <link.h> */
+#undef __LIBELF_NEED_LINK_H
+
+/* Define if Elf32_Dyn is declared in <sys/link.h> */
+#undef __LIBELF_NEED_SYS_LINK_H
+
+/* Define to `<elf.h>' or `<sys/elf.h>' if one of them is present */
+#undef __LIBELF_HEADER_ELF_H
+
+/* Define if you want 64-bit support (and your system supports it) */
+#define __LIBELF64 1
+
+/* Define if you want 64-bit support, and are running IRIX */
+#undef __LIBELF64_IRIX
+
+/* Define if you want 64-bit support, and are running Linux */
+#undef __LIBELF64_LINUX
+
+/* Define if you want symbol versioning (and your system supports it) */
+#define __LIBELF_SYMBOL_VERSIONS 1
+
+/* Define if symbol versioning uses Sun section type (SHT_SUNW_*) */
+#define __LIBELF_SUN_SYMBOL_VERSIONS 1
+
+/* Define if symbol versioning uses GNU section types (SHT_GNU_*) */
+#undef __LIBELF_GNU_SYMBOL_VERSIONS
+
+/* Define to a 64-bit signed integer type if one exists */
+#define __libelf_i64_t __int64
+
+/* Define to a 64-bit unsigned integer type if one exists */
+#define __libelf_u64_t unsigned __int64
+
+/* Define to a 32-bit signed integer type if one exists */
+#define __libelf_i32_t int
+
+/* Define to a 32-bit unsigned integer type if one exists */
+#define __libelf_u32_t unsigned int
+
+/* Define to a 16-bit signed integer type if one exists */
+#define __libelf_i16_t short int
+
+/* Define to a 16-bit unsigned integer type if one exists */
+#define __libelf_u16_t unsigned short int
+
+/* The number of bytes in a __int64.  */
+#define SIZEOF___INT64 8
+
+/* The number of bytes in a int.  */
+#define SIZEOF_INT 4
+
+/* The number of bytes in a long.  */
+#define SIZEOF_LONG 4
+
+/* The number of bytes in a long long.  */
+#define SIZEOF_LONG_LONG 0
+
+/* The number of bytes in a short.  */
+#define SIZEOF_SHORT 2
+
+/* Define if you have the ftruncate function.  */
+#undef HAVE_FTRUNCATE
+
+/* Define if you have the getpagesize function.  */
+#undef HAVE_GETPAGESIZE
+
+/* Define if you have the memcmp function.  */
+#define HAVE_MEMCMP 1
+
+/* Define if you have the memcpy function.  */
+#define HAVE_MEMCPY 1
+
+/* Define if you have the memmove function.  */
+#define HAVE_MEMMOVE 1
+
+/* Define if you have the memset function.  */
+#define HAVE_MEMSET 1
+
+/* Define if you have the <ar.h> header file.  */
+#undef HAVE_AR_H
+
+/* Define if you have the <elf.h> header file.  */
+#undef HAVE_ELF_H
+
+/* Define if you have the <fcntl.h> header file.  */
+#undef HAVE_FCNTL_H
+
+/* Define if you have the <gelf.h> header file.  */
+#undef HAVE_GELF_H
+
+/* Define if you have the <libelf.h> header file.  */
+#undef HAVE_LIBELF_H
+
+/* Define if you have the <link.h> header file.  */
+#undef HAVE_LINK_H
+
+/* Define if you have the <nlist.h> header file.  */
+#undef HAVE_NLIST_H
+
+/* Define if you have the <sys/elf.h> header file.  */
+#undef HAVE_SYS_ELF_H
+
+/* Define if you have the <sys/link.h> header file.  */
+#undef HAVE_SYS_LINK_H
+
+/* Define if you have the <unistd.h> header file.  */
+#undef HAVE_UNISTD_H

+ 501 - 0
lib/libelf/lib/cook.c

@@ -0,0 +1,501 @@
+/*
+ * cook.c - read and translate ELF files.
+ * Copyright (C) 1995 - 2006 Michael Riepe
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: cook.c,v 1.29 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+const Elf_Scn _elf_scn_init = INIT_SCN;
+const Scn_Data _elf_data_init = INIT_DATA;
+
+Elf_Type
+_elf_scn_type(unsigned t) {
+    switch (t) {
+	case SHT_DYNAMIC:       return ELF_T_DYN;
+	case SHT_DYNSYM:        return ELF_T_SYM;
+	case SHT_HASH:          return ELF_T_WORD;
+	case SHT_REL:           return ELF_T_REL;
+	case SHT_RELA:          return ELF_T_RELA;
+	case SHT_SYMTAB:        return ELF_T_SYM;
+	case SHT_SYMTAB_SHNDX:	return ELF_T_WORD;	/* XXX: really? */
+#if __LIBELF_SYMBOL_VERSIONS
+#if __LIBELF_SUN_SYMBOL_VERSIONS
+	case SHT_SUNW_verdef:   return ELF_T_VDEF;
+	case SHT_SUNW_verneed:  return ELF_T_VNEED;
+	case SHT_SUNW_versym:   return ELF_T_HALF;
+#else /* __LIBELF_SUN_SYMBOL_VERSIONS */
+	case SHT_GNU_verdef:    return ELF_T_VDEF;
+	case SHT_GNU_verneed:   return ELF_T_VNEED;
+	case SHT_GNU_versym:    return ELF_T_HALF;
+#endif /* __LIBELF_SUN_SYMBOL_VERSIONS */
+#endif /* __LIBELF_SYMBOL_VERSIONS */
+    }
+    return ELF_T_BYTE;
+}
+
+/*
+ * Check for overflow on 32-bit systems
+ */
+#define overflow(a,b,t)	(sizeof(a) < sizeof(t) && (t)(a) != (b))
+
+#define truncerr(t) ((t)==ELF_T_EHDR?ERROR_TRUNC_EHDR:	\
+		    ((t)==ELF_T_PHDR?ERROR_TRUNC_PHDR:	\
+		    ERROR_INTERNAL))
+#define memerr(t)   ((t)==ELF_T_EHDR?ERROR_MEM_EHDR:	\
+		    ((t)==ELF_T_PHDR?ERROR_MEM_PHDR:	\
+		    ERROR_INTERNAL))
+
+Elf_Data*
+_elf_xlatetom(const Elf *elf, Elf_Data *dst, const Elf_Data *src) {
+    if (elf->e_class == ELFCLASS32) {
+	return elf32_xlatetom(dst, src, elf->e_encoding);
+    }
+#if __LIBELF64
+    else if (elf->e_class == ELFCLASS64) {
+	return elf64_xlatetom(dst, src, elf->e_encoding);
+    }
+#endif /* __LIBELF64 */
+    seterr(ERROR_UNIMPLEMENTED);
+    return NULL;
+}
+
+static char*
+_elf_item(void *buf, Elf *elf, Elf_Type type, size_t off) {
+    Elf_Data src, dst;
+
+    elf_assert(valid_type(type));
+    if (off < 0 || off > elf->e_size) {
+	seterr(ERROR_OUTSIDE);
+	return NULL;
+    }
+
+    src.d_type = type;
+    src.d_version = elf->e_version;
+    src.d_size = _fsize(elf->e_class, src.d_version, type);
+    elf_assert(src.d_size);
+    if ((elf->e_size - off) < src.d_size) {
+	seterr(truncerr(type));
+	return NULL;
+    }
+
+    dst.d_version = _elf_version;
+    dst.d_size = _msize(elf->e_class, dst.d_version, type);
+    elf_assert(dst.d_size);
+
+    if (!(dst.d_buf = buf) && !(dst.d_buf = malloc(dst.d_size))) {
+	seterr(memerr(type));
+	return NULL;
+    }
+
+    elf_assert(elf->e_data);
+    if (elf->e_rawdata) {
+	src.d_buf = elf->e_rawdata + off;
+    }
+    else {
+	src.d_buf = elf->e_data + off;
+    }
+
+    if (_elf_xlatetom(elf, &dst, &src)) {
+	return (char*)dst.d_buf;
+    }
+    if (dst.d_buf != buf) {
+	free(dst.d_buf);
+    }
+    return NULL;
+}
+
+static int
+_elf_cook_phdr(Elf *elf) {
+    size_t num, off, entsz;
+
+    if (elf->e_class == ELFCLASS32) {
+	num = ((Elf32_Ehdr*)elf->e_ehdr)->e_phnum;
+	off = ((Elf32_Ehdr*)elf->e_ehdr)->e_phoff;
+	entsz = ((Elf32_Ehdr*)elf->e_ehdr)->e_phentsize;
+    }
+#if __LIBELF64
+    else if (elf->e_class == ELFCLASS64) {
+	num = ((Elf64_Ehdr*)elf->e_ehdr)->e_phnum;
+	off = ((Elf64_Ehdr*)elf->e_ehdr)->e_phoff;
+	entsz = ((Elf64_Ehdr*)elf->e_ehdr)->e_phentsize;
+	/*
+	 * Check for overflow on 32-bit systems
+	 */
+	if (overflow(off, ((Elf64_Ehdr*)elf->e_ehdr)->e_phoff, Elf64_Off)) {
+	    seterr(ERROR_OUTSIDE);
+	    return 0;
+	}
+    }
+#endif /* __LIBELF64 */
+    else {
+	seterr(ERROR_UNIMPLEMENTED);
+	return 0;
+    }
+    if (off) {
+	Elf_Scn *scn;
+	size_t size;
+	unsigned i;
+	char *p;
+
+	if (num == PN_XNUM) {
+	    /*
+	     * Overflow in ehdr->e_phnum.
+	     * Get real value from first SHDR.
+	     */
+	    if (!(scn = elf->e_scn_1)) {
+		seterr(ERROR_NOSUCHSCN);
+		return 0;
+	    }
+	    if (elf->e_class == ELFCLASS32) {
+		num = scn->s_shdr32.sh_info;
+	    }
+#if __LIBELF64
+	    else if (elf->e_class == ELFCLASS64) {
+		num = scn->s_shdr64.sh_info;
+	    }
+#endif /* __LIBELF64 */
+	    /* we already had this
+	    else {
+		seterr(ERROR_UNIMPLEMENTED);
+		return 0;
+	    }
+	    */
+	}
+
+	size = _fsize(elf->e_class, elf->e_version, ELF_T_PHDR);
+	elf_assert(size);
+#if ENABLE_EXTENDED_FORMAT
+	if (entsz < size) {
+#else /* ENABLE_EXTENDED_FORMAT */
+	if (entsz != size) {
+#endif /* ENABLE_EXTENDED_FORMAT */
+	    seterr(ERROR_EHDR_PHENTSIZE);
+	    return 0;
+	}
+	size = _msize(elf->e_class, _elf_version, ELF_T_PHDR);
+	elf_assert(size);
+	if (!(p = malloc(num * size))) {
+	    seterr(memerr(ELF_T_PHDR));
+	    return 0;
+	}
+	for (i = 0; i < num; i++) {
+	    if (!_elf_item(p + i * size, elf, ELF_T_PHDR, off + i * entsz)) {
+		free(p);
+		return 0;
+	    }
+	}
+	elf->e_phdr = p;
+	elf->e_phnum = num;
+    }
+    return 1;
+}
+
+static int
+_elf_cook_shdr(Elf *elf) {
+    size_t num, off, entsz;
+
+    if (elf->e_class == ELFCLASS32) {
+	num = ((Elf32_Ehdr*)elf->e_ehdr)->e_shnum;
+	off = ((Elf32_Ehdr*)elf->e_ehdr)->e_shoff;
+	entsz = ((Elf32_Ehdr*)elf->e_ehdr)->e_shentsize;
+    }
+#if __LIBELF64
+    else if (elf->e_class == ELFCLASS64) {
+	num = ((Elf64_Ehdr*)elf->e_ehdr)->e_shnum;
+	off = ((Elf64_Ehdr*)elf->e_ehdr)->e_shoff;
+	entsz = ((Elf64_Ehdr*)elf->e_ehdr)->e_shentsize;
+	/*
+	 * Check for overflow on 32-bit systems
+	 */
+	if (overflow(off, ((Elf64_Ehdr*)elf->e_ehdr)->e_shoff, Elf64_Off)) {
+	    seterr(ERROR_OUTSIDE);
+	    return 0;
+	}
+    }
+#endif /* __LIBELF64 */
+    else {
+	seterr(ERROR_UNIMPLEMENTED);
+	return 0;
+    }
+    if (off) {
+	struct tmp {
+	    Elf_Scn	scn;
+	    Scn_Data	data;
+	} *head;
+	Elf_Data src, dst;
+	Elf_Scn *scn;
+	Scn_Data *sd;
+	unsigned i;
+
+	if (off < 0 || off > elf->e_size) {
+	    seterr(ERROR_OUTSIDE);
+	    return 0;
+	}
+
+	src.d_type = ELF_T_SHDR;
+	src.d_version = elf->e_version;
+	src.d_size = _fsize(elf->e_class, src.d_version, ELF_T_SHDR);
+	elf_assert(src.d_size);
+#if ENABLE_EXTENDED_FORMAT
+	if (entsz < src.d_size) {
+#else /* ENABLE_EXTENDED_FORMAT */
+	if (entsz != src.d_size) {
+#endif /* ENABLE_EXTENDED_FORMAT */
+	    seterr(ERROR_EHDR_SHENTSIZE);
+	    return 0;
+	}
+	dst.d_version = EV_CURRENT;
+
+	if (num == 0) {
+	    union {
+		Elf32_Shdr sh32;
+#if __LIBELF64
+		Elf64_Shdr sh64;
+#endif /* __LIBELF64 */
+	    } u;
+
+	    /*
+	     * Overflow in ehdr->e_shnum.
+	     * Get real value from first SHDR.
+	     */
+	    if (elf->e_size - off < entsz) {
+		seterr(ERROR_TRUNC_SHDR);
+		return 0;
+	    }
+	    if (elf->e_rawdata) {
+		src.d_buf = elf->e_rawdata + off;
+	    }
+	    else {
+		src.d_buf = elf->e_data + off;
+	    }
+	    dst.d_buf = &u;
+	    dst.d_size = sizeof(u);
+	    if (!_elf_xlatetom(elf, &dst, &src)) {
+		return 0;
+	    }
+	    elf_assert(dst.d_size == _msize(elf->e_class, EV_CURRENT, ELF_T_SHDR));
+	    elf_assert(dst.d_type == ELF_T_SHDR);
+	    if (elf->e_class == ELFCLASS32) {
+		num = u.sh32.sh_size;
+	    }
+#if __LIBELF64
+	    else if (elf->e_class == ELFCLASS64) {
+		num = u.sh64.sh_size;
+		/*
+		 * Check for overflow on 32-bit systems
+		 */
+		if (overflow(num, u.sh64.sh_size, Elf64_Xword)) {
+		    seterr(ERROR_OUTSIDE);
+		    return 0;
+		}
+	    }
+#endif /* __LIBELF64 */
+	}
+
+	if ((elf->e_size - off) / entsz < num) {
+	    seterr(ERROR_TRUNC_SHDR);
+	    return 0;
+	}
+
+	if (!(head = (struct tmp*)malloc(num * sizeof(struct tmp)))) {
+	    seterr(ERROR_MEM_SCN);
+	    return 0;
+	}
+	for (scn = NULL, i = num; i-- > 0; ) {
+	    head[i].scn = _elf_scn_init;
+	    head[i].data = _elf_data_init;
+	    head[i].scn.s_link = scn;
+	    if (!scn) {
+		elf->e_scn_n = &head[i].scn;
+	    }
+	    scn = &head[i].scn;
+	    sd = &head[i].data;
+
+	    if (elf->e_rawdata) {
+		src.d_buf = elf->e_rawdata + off + i * entsz;
+	    }
+	    else {
+		src.d_buf = elf->e_data + off + i * entsz;
+	    }
+	    dst.d_buf = &scn->s_uhdr;
+	    dst.d_size = sizeof(scn->s_uhdr);
+	    if (!_elf_xlatetom(elf, &dst, &src)) {
+		elf->e_scn_n = NULL;
+		free(head);
+		return 0;
+	    }
+	    elf_assert(dst.d_size == _msize(elf->e_class, EV_CURRENT, ELF_T_SHDR));
+	    elf_assert(dst.d_type == ELF_T_SHDR);
+
+	    scn->s_elf = elf;
+	    scn->s_index = i;
+	    scn->s_data_1 = sd;
+	    scn->s_data_n = sd;
+
+	    sd->sd_scn = scn;
+
+	    if (elf->e_class == ELFCLASS32) {
+		Elf32_Shdr *shdr = &scn->s_shdr32;
+
+		scn->s_type = shdr->sh_type;
+		scn->s_size = shdr->sh_size;
+		scn->s_offset = shdr->sh_offset;
+		sd->sd_data.d_align = shdr->sh_addralign;
+		sd->sd_data.d_type = _elf_scn_type(scn->s_type);
+	    }
+#if __LIBELF64
+	    else if (elf->e_class == ELFCLASS64) {
+		Elf64_Shdr *shdr = &scn->s_shdr64;
+
+		scn->s_type = shdr->sh_type;
+		scn->s_size = shdr->sh_size;
+		scn->s_offset = shdr->sh_offset;
+		sd->sd_data.d_align = shdr->sh_addralign;
+		/*
+		 * Check for overflow on 32-bit systems
+		 */
+		if (overflow(scn->s_size, shdr->sh_size, Elf64_Xword)
+		 || overflow(scn->s_offset, shdr->sh_offset, Elf64_Off)
+		 || overflow(sd->sd_data.d_align, shdr->sh_addralign, Elf64_Xword)) {
+		    seterr(ERROR_OUTSIDE);
+		    return 0;
+		}
+		sd->sd_data.d_type = _elf_scn_type(scn->s_type);
+		/*
+		 * QUIRKS MODE:
+		 *
+		 * Some 64-bit architectures use 64-bit entries in the
+		 * .hash section. This violates the ELF standard, and
+		 * should be fixed. It's mostly harmless as long as the
+		 * binary and the machine running your program have the
+		 * same byte order, but you're in trouble if they don't,
+		 * and if the entry size is wrong.
+		 *
+		 * As a workaround, I let libelf guess the right size
+		 * for the binary. This relies pretty much on the fact
+		 * that the binary provides correct data in the section
+		 * headers. If it doesn't, it's probably broken anyway.
+		 * Therefore, libelf uses a standard conforming value
+		 * when it's not absolutely sure.
+		 */
+		if (scn->s_type == SHT_HASH) {
+		    int override = 0;
+
+		    /*
+		     * sh_entsize must reflect the entry size
+		     */
+		    if (shdr->sh_entsize == ELF64_FSZ_ADDR) {
+			override++;
+		    }
+		    /*
+		     * sh_size must be a multiple of sh_entsize
+		     */
+		    if (shdr->sh_size % ELF64_FSZ_ADDR == 0) {
+			override++;
+		    }
+		    /*
+		     * There must be room for at least 2 entries
+		     */
+		    if (shdr->sh_size >= 2 * ELF64_FSZ_ADDR) {
+			override++;
+		    }
+		    /*
+		     * sh_addralign must be correctly set
+		     */
+		    if (shdr->sh_addralign == ELF64_FSZ_ADDR) {
+			override++;
+		    }
+		    /*
+		     * The section must be properly aligned
+		     */
+		    if (shdr->sh_offset % ELF64_FSZ_ADDR == 0) {
+			override++;
+		    }
+		    /* XXX: also look at the data? */
+		    /*
+		     * Make a conservative decision...
+		     */
+		    if (override >= 5) {
+			sd->sd_data.d_type = ELF_T_ADDR;
+		    }
+		}
+		/*
+		 * END QUIRKS MODE.
+		 */
+	    }
+#endif /* __LIBELF64 */
+	    /* we already had this
+	    else {
+		seterr(ERROR_UNIMPLEMENTED);
+		return 0;
+	    }
+	    */
+
+	    sd->sd_data.d_size = scn->s_size;
+	    sd->sd_data.d_version = _elf_version;
+	}
+	elf_assert(scn == &head[0].scn);
+	elf->e_scn_1 = &head[0].scn;
+	head[0].scn.s_freeme = 1;
+    }
+    return 1;
+}
+
+static int
+_elf_cook_file(Elf *elf) {
+    elf->e_ehdr = _elf_item(NULL, elf, ELF_T_EHDR, 0);
+    if (!elf->e_ehdr) {
+	return 0;
+    }
+    /*
+     * Note: _elf_cook_phdr may require the first section header!
+     */
+    if (!_elf_cook_shdr(elf)) {
+	return 0;
+    }
+    if (!_elf_cook_phdr(elf)) {
+	return 0;
+    }
+    return 1;
+}
+
+int
+_elf_cook(Elf *elf) {
+    elf_assert(_elf_scn_init.s_magic == SCN_MAGIC);
+    elf_assert(_elf_data_init.sd_magic == DATA_MAGIC);
+    elf_assert(elf);
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    elf_assert(elf->e_kind == ELF_K_ELF);
+    elf_assert(!elf->e_ehdr);
+    if (!valid_version(elf->e_version)) {
+	seterr(ERROR_UNKNOWN_VERSION);
+    }
+    else if (!valid_encoding(elf->e_encoding)) {
+	seterr(ERROR_UNKNOWN_ENCODING);
+    }
+    else if (valid_class(elf->e_class)) {
+	return _elf_cook_file(elf);
+    }
+    else {
+	seterr(ERROR_UNKNOWN_CLASS);
+    }
+    return 0;
+}

+ 36 - 0
lib/libelf/lib/data.c

@@ -0,0 +1,36 @@
+/*
+ * data.c - libelf internal variables.
+ * Copyright (C) 1995 - 1998, 2007 Michael Riepe
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: data.c,v 1.8 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+unsigned _elf_version = EV_NONE;
+int _elf_errno = 0;
+int _elf_fill = 0;
+
+#if ENABLE_SANITY_CHECKS
+#define SANITY_CHECKS	-1
+#else
+#define SANITY_CHECKS	0
+#endif
+
+int _elf_sanity_checks = SANITY_CHECKS;

+ 996 - 0
lib/libelf/lib/elf_repl.h

@@ -0,0 +1,996 @@
+/*
+ * elf_repl.h - public header file for systems that lack it.
+ * Copyright (C) 1995 - 2006 Michael Riepe
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+/* @(#) $Id: elf_repl.h,v 1.22 2009/11/01 13:04:19 michael Exp $ */
+
+/*
+ * NEVER INCLUDE THIS FILE DIRECTLY - USE <libelf.h> INSTEAD!
+ */
+
+#ifndef _ELF_REPL_H
+#define _ELF_REPL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Scalar data types
+ */
+typedef __libelf_u32_t		Elf32_Addr;
+typedef __libelf_u16_t		Elf32_Half;
+typedef __libelf_u32_t		Elf32_Off;
+typedef __libelf_i32_t		Elf32_Sword;
+typedef __libelf_u32_t		Elf32_Word;
+
+#define ELF32_FSZ_ADDR		4
+#define ELF32_FSZ_HALF		2
+#define ELF32_FSZ_OFF		4
+#define ELF32_FSZ_SWORD		4
+#define ELF32_FSZ_WORD		4
+
+#if __LIBELF64
+
+typedef __libelf_u64_t		Elf64_Addr;
+typedef __libelf_u16_t		Elf64_Half;
+typedef __libelf_u64_t		Elf64_Off;
+typedef __libelf_i32_t		Elf64_Sword;
+typedef __libelf_u32_t		Elf64_Word;
+typedef __libelf_i64_t		Elf64_Sxword;
+typedef __libelf_u64_t		Elf64_Xword;
+
+#define ELF64_FSZ_ADDR		8
+#define ELF64_FSZ_HALF		2
+#define ELF64_FSZ_OFF		8
+#define ELF64_FSZ_SWORD		4
+#define ELF64_FSZ_WORD		4
+#define ELF64_FSZ_SXWORD	8
+#define ELF64_FSZ_XWORD		8
+
+/*
+ * Blame Sun for this...
+ */
+typedef __libelf_u64_t		Elf64_Lword;
+typedef __libelf_u64_t		Elf32_Lword;
+
+#endif /* __LIBELF64 */
+
+/*
+ * ELF header
+ */
+#define EI_NIDENT	16
+
+typedef struct {
+    unsigned char	e_ident[EI_NIDENT];
+    Elf32_Half		e_type;
+    Elf32_Half		e_machine;
+    Elf32_Word		e_version;
+    Elf32_Addr		e_entry;
+    Elf32_Off		e_phoff;
+    Elf32_Off		e_shoff;
+    Elf32_Word		e_flags;
+    Elf32_Half		e_ehsize;
+    Elf32_Half		e_phentsize;
+    Elf32_Half		e_phnum;
+    Elf32_Half		e_shentsize;
+    Elf32_Half		e_shnum;
+    Elf32_Half		e_shstrndx;
+} Elf32_Ehdr;
+
+#if __LIBELF64
+typedef struct {
+    unsigned char	e_ident[EI_NIDENT];
+    Elf64_Half		e_type;
+    Elf64_Half		e_machine;
+    Elf64_Word		e_version;
+    Elf64_Addr		e_entry;
+    Elf64_Off		e_phoff;
+    Elf64_Off		e_shoff;
+    Elf64_Word		e_flags;
+    Elf64_Half		e_ehsize;
+    Elf64_Half		e_phentsize;
+    Elf64_Half		e_phnum;
+    Elf64_Half		e_shentsize;
+    Elf64_Half		e_shnum;
+    Elf64_Half		e_shstrndx;
+} Elf64_Ehdr;
+#endif /* __LIBELF64 */
+
+/*
+ * e_ident
+ */
+#define EI_MAG0		0
+#define EI_MAG1		1
+#define EI_MAG2		2
+#define EI_MAG3		3
+#define EI_CLASS	4
+#define EI_DATA		5
+#define EI_VERSION	6
+#define EI_OSABI	7
+#define EI_ABIVERSION	8
+#define EI_PAD		9
+
+#define ELFMAG0		0x7f
+#define ELFMAG1		'E'
+#define ELFMAG2		'L'
+#define ELFMAG3		'F'
+#define ELFMAG		"\177ELF"
+#define SELFMAG		4
+
+/*
+ * e_ident[EI_CLASS]
+ */
+#define ELFCLASSNONE	0
+#define ELFCLASS32	1
+#define ELFCLASS64	2
+#define ELFCLASSNUM	3
+
+/*
+ * e_ident[EI_DATA]
+ */
+#define ELFDATANONE	0
+#define ELFDATA2LSB	1
+#define ELFDATA2MSB	2
+#define ELFDATANUM	3
+
+/*
+ * e_ident[EI_OSABI]
+ */
+#define ELFOSABI_NONE		0	/* No extensions or unspecified */
+#define ELFOSABI_SYSV		ELFOSABI_NONE
+#define ELFOSABI_HPUX		1	/* Hewlett-Packard HP-UX */
+#define ELFOSABI_NETBSD		2	/* NetBSD */
+#define ELFOSABI_LINUX		3	/* Linux */
+#define ELFOSABI_SOLARIS	6	/* Sun Solaris */
+#define ELFOSABI_AIX		7	/* AIX */
+#define ELFOSABI_IRIX		8	/* IRIX */
+#define ELFOSABI_FREEBSD	9	/* FreeBSD */
+#define ELFOSABI_TRU64		10	/* Compaq TRU64 UNIX */
+#define ELFOSABI_MODESTO	11	/* Novell Modesto */
+#define ELFOSABI_OPENBSD	12	/* Open BSD */
+#define ELFOSABI_OPENVMS	13	/* Open VMS */
+#define ELFOSABI_NSK		14	/* Hewlett-Packard Non-Stop Kernel */
+#define ELFOSABI_AROS	 	15 	/* Amiga Research OS */
+/* these are probably obsolete: */
+#define ELFOSABI_ARM		97	/* ARM */
+#define ELFOSABI_STANDALONE	255	/* standalone (embedded) application */
+
+
+/*
+ * e_type
+ */
+#define ET_NONE		0
+#define ET_REL		1
+#define ET_EXEC		2
+#define ET_DYN		3
+#define ET_CORE		4
+#define ET_NUM		5
+#define ET_LOOS		0xfe00
+#define ET_HIOS		0xfeff
+#define ET_LOPROC	0xff00
+#define ET_HIPROC	0xffff
+
+/*
+ * e_machine
+ */
+#define EM_NONE		0	/* No machine */
+#define EM_M32		1	/* AT&T WE 32100 */
+#define EM_SPARC	2	/* SPARC */
+#define EM_386		3	/* Intel 80386 */
+#define EM_68K		4	/* Motorola 68000 */
+#define EM_88K		5	/* Motorola 88000 */
+#define EM_486		6	/* Intel i486 (DO NOT USE THIS ONE) */
+#define EM_860		7	/* Intel 80860 */
+#define EM_MIPS		8	/* MIPS I Architecture */
+#define EM_S370		9	/* IBM System/370 Processor */
+#define EM_MIPS_RS3_LE	10	/* MIPS RS3000 Little-endian */
+#define EM_SPARC64	11	/* SPARC 64-bit */
+#define EM_PARISC	15	/* Hewlett-Packard PA-RISC */
+#define EM_VPP500	17	/* Fujitsu VPP500 */
+#define EM_SPARC32PLUS	18	/* Enhanced instruction set SPARC */
+#define EM_960		19	/* Intel 80960 */
+#define EM_PPC		20	/* PowerPC */
+#define EM_PPC64	21	/* 64-bit PowerPC */
+#define EM_S390		22	/* IBM System/390 Processor */
+#define EM_V800		36	/* NEC V800 */
+#define EM_FR20		37	/* Fujitsu FR20 */
+#define EM_RH32		38	/* TRW RH-32 */
+#define EM_RCE		39	/* Motorola RCE */
+#define EM_ARM		40	/* Advanced RISC Machines ARM */
+#define EM_ALPHA	41	/* Digital Alpha */
+#define EM_SH		42	/* Hitachi SH */
+#define EM_SPARCV9	43	/* SPARC Version 9 */
+#define EM_TRICORE	44	/* Siemens TriCore embedded processor */
+#define EM_ARC		45	/* Argonaut RISC Core, Argonaut Technologies Inc. */
+#define EM_H8_300	46	/* Hitachi H8/300 */
+#define EM_H8_300H	47	/* Hitachi H8/300H */
+#define EM_H8S		48	/* Hitachi H8S */
+#define EM_H8_500	49	/* Hitachi H8/500 */
+#define EM_IA_64	50	/* Intel IA-64 processor architecture */
+#define EM_MIPS_X	51	/* Stanford MIPS-X */
+#define EM_COLDFIRE	52	/* Motorola ColdFire */
+#define EM_68HC12	53	/* Motorola M68HC12 */
+#define EM_MMA		54	/* Fujitsu MMA Multimedia Accelerator */
+#define EM_PCP		55	/* Siemens PCP */
+#define EM_NCPU		56	/* Sony nCPU embedded RISC processor */
+#define EM_NDR1		57	/* Denso NDR1 microprocessor */
+#define EM_STARCORE	58	/* Motorola Star*Core processor */
+#define EM_ME16		59	/* Toyota ME16 processor */
+#define EM_ST100	60	/* STMicroelectronics ST100 processor */
+#define EM_TINYJ	61	/* Advanced Logic Corp. TinyJ embedded processor family */
+#define EM_X86_64	62	/* AMD x86-64 architecture */
+#define EM_AMD64	EM_X86_64
+#define EM_PDSP		63	/* Sony DSP Processor */
+#define EM_FX66		66	/* Siemens FX66 microcontroller */
+#define EM_ST9PLUS	67	/* STMicroelectronics ST9+ 8/16 bit microcontroller */
+#define EM_ST7		68	/* STMicroelectronics ST7 8-bit microcontroller */
+#define EM_68HC16	69	/* Motorola MC68HC16 Microcontroller */
+#define EM_68HC11	70	/* Motorola MC68HC11 Microcontroller */
+#define EM_68HC08	71	/* Motorola MC68HC08 Microcontroller */
+#define EM_68HC05	72	/* Motorola MC68HC05 Microcontroller */
+#define EM_SVX		73	/* Silicon Graphics SVx */
+#define EM_ST19		74	/* STMicroelectronics ST19 8-bit microcontroller */
+#define EM_VAX		75	/* Digital VAX */
+#define EM_CRIS		76	/* Axis Communications 32-bit embedded processor */
+#define EM_JAVELIN	77	/* Infineon Technologies 32-bit embedded processor */
+#define EM_FIREPATH	78	/* Element 14 64-bit DSP Processor */
+#define EM_ZSP		79	/* LSI Logic 16-bit DSP Processor */
+#define EM_MMIX		80	/* Donald Knuth's educational 64-bit processor */
+#define EM_HUANY	81	/* Harvard University machine-independent object files */
+#define EM_PRISM	82	/* SiTera Prism */
+#define EM_AVR		83	/* Atmel AVR 8-bit microcontroller */
+#define EM_FR30		84	/* Fujitsu FR30 */
+#define EM_D10V		85	/* Mitsubishi D10V */
+#define EM_D30V		86	/* Mitsubishi D30V */
+#define EM_V850		87	/* NEC v850 */
+#define EM_M32R		88	/* Mitsubishi M32R */
+#define EM_MN10300	89	/* Matsushita MN10300 */
+#define EM_MN10200	90	/* Matsushita MN10200 */
+#define EM_PJ		91	/* picoJava */
+#define EM_OPENRISC	92	/* OpenRISC 32-bit embedded processor */
+#define EM_ARC_A5	93	/* ARC Cores Tangent-A5 */
+#define EM_XTENSA	94	/* Tensilica Xtensa Architecture */
+#define EM_VIDEOCORE	95	/* Alphamosaic VideoCore processor */
+#define EM_TMM_GPP	96	/* Thompson Multimedia General Purpose Processor */
+#define EM_NS32K	97	/* National Semiconductor 32000 series */
+#define EM_TPC		98	/* Tenor Network TPC processor */
+#define EM_SNP1K	99	/* Trebia SNP 1000 processor */
+#define EM_ST200	100	/* STMicroelectronics (www.st.com) ST200 microcontroller */
+#define EM_IP2K 	101 	/* Ubicom IP2xxx microcontroller family */
+#define EM_MAX 		102 	/* MAX Processor */
+#define EM_CR 		103 	/* National Semiconductor CompactRISC microprocessor */
+#define EM_F2MC16 	104 	/* Fujitsu F2MC16 */
+#define EM_MSP430 	105 	/* Texas Instruments embedded microcontroller msp430 */
+#define EM_BLACKFIN	106 	/* Analog Devices Blackfin (DSP) processor */
+#define EM_SE_C33 	107 	/* S1C33 Family of Seiko Epson processors */
+#define EM_SEP 		108 	/* Sharp embedded microprocessor */
+#define EM_ARCA 	109 	/* Arca RISC Microprocessor */
+#define EM_UNICORE 	110 	/* Microprocessor series from PKU-Unity Ltd. and MPRC of Peking University */
+#define EM_NUM		111
+
+/*
+ * e_ident[EI_VERSION], e_version
+ */
+#define EV_NONE		0
+#define EV_CURRENT	1
+#define EV_NUM		2
+
+/*
+ * Section header
+ */
+typedef struct {
+    Elf32_Word		sh_name;
+    Elf32_Word		sh_type;
+    Elf32_Word		sh_flags;
+    Elf32_Addr		sh_addr;
+    Elf32_Off		sh_offset;
+    Elf32_Word		sh_size;
+    Elf32_Word		sh_link;
+    Elf32_Word		sh_info;
+    Elf32_Word		sh_addralign;
+    Elf32_Word		sh_entsize;
+} Elf32_Shdr;
+
+#if __LIBELF64
+typedef struct {
+    Elf64_Word		sh_name;
+    Elf64_Word		sh_type;
+    Elf64_Xword		sh_flags;
+    Elf64_Addr		sh_addr;
+    Elf64_Off		sh_offset;
+    Elf64_Xword		sh_size;
+    Elf64_Word		sh_link;
+    Elf64_Word		sh_info;
+    Elf64_Xword		sh_addralign;
+    Elf64_Xword		sh_entsize;
+} Elf64_Shdr;
+#endif /* __LIBELF64 */
+
+/*
+ * Special section indices
+ */
+#define SHN_UNDEF	0
+#define SHN_LORESERVE	0xff00
+#define SHN_LOPROC	0xff00
+#define SHN_HIPROC	0xff1f
+#define SHN_LOOS	0xff20
+#define SHN_HIOS	0xff3f
+#define SHN_ABS		0xfff1
+#define SHN_COMMON	0xfff2
+#define SHN_XINDEX	0xffff
+#define SHN_HIRESERVE	0xffff
+
+/*
+ * sh_type
+ */
+#define SHT_NULL		0
+#define SHT_PROGBITS		1
+#define SHT_SYMTAB		2
+#define SHT_STRTAB		3
+#define SHT_RELA		4
+#define SHT_HASH		5
+#define SHT_DYNAMIC		6
+#define SHT_NOTE		7
+#define SHT_NOBITS		8
+#define SHT_REL			9
+#define SHT_SHLIB		10
+#define SHT_DYNSYM		11
+#define SHT_INIT_ARRAY		14
+#define SHT_FINI_ARRAY		15
+#define SHT_PREINIT_ARRAY	16
+#define SHT_GROUP		17
+#define SHT_SYMTAB_SHNDX	18
+#define SHT_NUM			19
+#define SHT_LOOS		0x60000000
+#define SHT_HIOS		0x6fffffff
+#define SHT_LOPROC		0x70000000
+#define SHT_HIPROC		0x7fffffff
+#define SHT_LOUSER		0x80000000
+#define SHT_HIUSER		0xffffffff
+
+/*
+ * Solaris extensions
+ */
+#define SHT_LOSUNW		0x6ffffff4
+#define SHT_SUNW_dof		0x6ffffff4
+#define SHT_SUNW_cap		0x6ffffff5
+#define SHT_SUNW_SIGNATURE	0x6ffffff6
+#define SHT_SUNW_ANNOTATE	0x6ffffff7
+#define SHT_SUNW_DEBUGSTR	0x6ffffff8
+#define SHT_SUNW_DEBUG		0x6ffffff9
+#define SHT_SUNW_move		0x6ffffffa
+#define SHT_SUNW_COMDAT		0x6ffffffb
+#define SHT_SUNW_syminfo	0x6ffffffc
+#define SHT_SUNW_verdef		0x6ffffffd
+#define SHT_SUNW_verneed	0x6ffffffe
+#define SHT_SUNW_versym		0x6fffffff
+#define SHT_HISUNW		0x6fffffff
+
+#define SHT_SPARC_GOTDATA	0x70000000
+#define SHT_AMD64_UNWIND	0x70000001 
+
+/*
+ * GNU extensions
+ */
+#define SHT_GNU_verdef		0x6ffffffd
+#define SHT_GNU_verneed		0x6ffffffe
+#define SHT_GNU_versym		0x6fffffff
+
+/*
+ * sh_flags
+ */
+#define SHF_WRITE		0x1
+#define SHF_ALLOC		0x2
+#define SHF_EXECINSTR		0x4
+#define SHF_MERGE		0x10
+#define SHF_STRINGS		0x20
+#define SHF_INFO_LINK		0x40
+#define SHF_LINK_ORDER		0x80
+#define SHF_OS_NONCONFORMING	0x100
+#define SHF_GROUP		0x200
+#define SHF_TLS			0x400
+#define SHF_MASKOS		0x0ff00000
+#define SHF_MASKPROC		0xf0000000
+
+/*
+ * Solaris extensions
+ */
+#define SHF_AMD64_LARGE		0x10000000
+#define SHF_ORDERED		0x40000000
+#define SHF_EXCLUDE		0x80000000
+
+/*
+ * Section group flags
+ */
+#define GRP_COMDAT		0x1
+#define GRP_MASKOS		0x0ff00000
+#define GRP_MASKPROC		0xf0000000
+
+/*
+ * Symbol table
+ */
+typedef struct {
+    Elf32_Word		st_name;
+    Elf32_Addr		st_value;
+    Elf32_Word		st_size;
+    unsigned char	st_info;
+    unsigned char	st_other;
+    Elf32_Half		st_shndx;
+} Elf32_Sym;
+
+#if __LIBELF64
+typedef struct {
+    Elf64_Word		st_name;
+    unsigned char	st_info;
+    unsigned char	st_other;
+    Elf64_Half		st_shndx;
+    Elf64_Addr		st_value;
+    Elf64_Xword		st_size;
+} Elf64_Sym;
+#endif /* __LIBELF64 */
+
+/*
+ * Special symbol indices
+ */
+#define STN_UNDEF	0
+
+/*
+ * Macros for manipulating st_info
+ */
+#define ELF32_ST_BIND(i)	((i)>>4)
+#define ELF32_ST_TYPE(i)	((i)&0xf)
+#define ELF32_ST_INFO(b,t)	(((b)<<4)+((t)&0xf))
+
+#if __LIBELF64
+#define ELF64_ST_BIND(i)	((i)>>4)
+#define ELF64_ST_TYPE(i)	((i)&0xf)
+#define ELF64_ST_INFO(b,t)	(((b)<<4)+((t)&0xf))
+#endif /* __LIBELF64 */
+
+/*
+ * Symbol binding
+ */
+#define STB_LOCAL	0
+#define STB_GLOBAL	1
+#define STB_WEAK	2
+#define STB_NUM		3
+#define STB_LOOS	10
+#define STB_HIOS	12
+#define STB_LOPROC	13
+#define STB_HIPROC	15
+
+/*
+ * Symbol types
+ */
+#define STT_NOTYPE	0
+#define STT_OBJECT	1
+#define STT_FUNC	2
+#define STT_SECTION	3
+#define STT_FILE	4
+#define STT_COMMON	5
+#define STT_TLS		6
+#define STT_NUM		7
+#define STT_LOOS	10
+#define STT_HIOS	12
+#define STT_LOPROC	13
+#define STT_HIPROC	15
+
+/*
+ * Macros for manipulating st_other
+ */
+#define ELF32_ST_VISIBILITY(o)	((o)&0x3)
+#if __LIBELF64
+#define ELF64_ST_VISIBILITY(o)	((o)&0x3)
+#endif /* __LIBELF64 */
+
+/*
+ * Symbol visibility
+ */
+#define STV_DEFAULT	0
+#define STV_INTERNAL	1
+#define STV_HIDDEN	2
+#define STV_PROTECTED	3
+
+/*
+ * Relocation
+ */
+typedef struct {
+    Elf32_Addr		r_offset;
+    Elf32_Word		r_info;
+} Elf32_Rel;
+
+typedef struct {
+    Elf32_Addr		r_offset;
+    Elf32_Word		r_info;
+    Elf32_Sword		r_addend;
+} Elf32_Rela;
+
+#if __LIBELF64
+typedef struct {
+    Elf64_Addr		r_offset;
+    Elf64_Xword		r_info;
+} Elf64_Rel;
+
+typedef struct {
+    Elf64_Addr		r_offset;
+    Elf64_Xword		r_info;
+    Elf64_Sxword	r_addend;
+} Elf64_Rela;
+#endif /* __LIBELF64 */
+
+/*
+ * Macros for manipulating r_info
+ */
+#define ELF32_R_SYM(i)		((i)>>8)
+#define ELF32_R_TYPE(i)		((unsigned char)(i))
+#define ELF32_R_INFO(s,t)	(((s)<<8)+(unsigned char)(t))
+
+#if __LIBELF64
+#define ELF64_R_SYM(i)		((Elf64_Xword)(i)>>32)
+#define ELF64_R_TYPE(i)		((i)&0xffffffffL)
+#define ELF64_R_INFO(s,t)	(((Elf64_Xword)(s)<<32)+((t)&0xffffffffL))
+#endif /* __LIBELF64 */
+
+/*
+ * Note entry header
+ */
+typedef struct {
+    Elf32_Word		n_namesz;	/* name size */
+    Elf32_Word		n_descsz;	/* descriptor size */
+    Elf32_Word		n_type;		/* descriptor type */
+} Elf32_Nhdr;
+
+#if __LIBELF64
+/* Solaris and GNU use this layout.  Be compatible. */
+/* XXX: Latest ELF specs say it's 64-bit!!! */
+typedef struct {
+    Elf64_Word		n_namesz;	/* name size */
+    Elf64_Word		n_descsz;	/* descriptor size */
+    Elf64_Word		n_type;		/* descriptor type */
+} Elf64_Nhdr;
+#endif /* __LIBELF64 */
+
+/*
+ * Well-known descriptor types for ET_CORE files
+ */
+#define NT_PRSTATUS	1
+#define NT_PRFPREG	2
+#define NT_PRPSINFO	3
+
+/*
+ * Program header
+ */
+typedef struct {
+    Elf32_Word		p_type;
+    Elf32_Off		p_offset;
+    Elf32_Addr		p_vaddr;
+    Elf32_Addr		p_paddr;
+    Elf32_Word		p_filesz;
+    Elf32_Word		p_memsz;
+    Elf32_Word		p_flags;
+    Elf32_Word		p_align;
+} Elf32_Phdr;
+
+#if __LIBELF64
+typedef struct {
+    Elf64_Word		p_type;
+    Elf64_Word		p_flags;
+    Elf64_Off		p_offset;
+    Elf64_Addr		p_vaddr;
+    Elf64_Addr		p_paddr;
+    Elf64_Xword		p_filesz;
+    Elf64_Xword		p_memsz;
+    Elf64_Xword		p_align;
+} Elf64_Phdr;
+#endif /* __LIBELF64 */
+
+/*
+ * Special numbers
+ */
+#define PN_XNUM		0xffff
+
+/*
+ * p_type
+ */
+#define PT_NULL		0
+#define PT_LOAD		1
+#define PT_DYNAMIC	2
+#define PT_INTERP	3
+#define PT_NOTE		4
+#define PT_SHLIB	5
+#define PT_PHDR		6
+#define PT_TLS		7
+#define PT_NUM		8
+#define PT_LOOS		0x60000000
+#define PT_HIOS		0x6fffffff
+#define PT_LOPROC	0x70000000
+#define PT_HIPROC	0x7fffffff
+
+/*
+ * Solaris extensions
+ */
+
+#define PT_SUNW_UNWIND	0x6464e550
+#define PT_LOSUNW	0x6ffffffa
+#define PT_SUNWBSS	0x6ffffffa
+#define PT_SUNWSTACK	0x6ffffffb
+#define PT_SUNWDTRACE	0x6ffffffc
+#define PT_SUNWCAP	0x6ffffffd
+#define PT_HISUNW	0x6fffffff 
+
+/*
+ * p_flags
+ */
+#define PF_X		0x1
+#define PF_W		0x2
+#define PF_R		0x4
+#define PF_MASKOS	0x0ff00000
+#define PF_MASKPROC	0xf0000000
+
+/*
+ * Dynamic structure
+ */
+typedef struct {
+    Elf32_Sword		d_tag;
+    union {
+	Elf32_Word	d_val;
+	Elf32_Addr	d_ptr;
+    } d_un;
+} Elf32_Dyn;
+
+#if __LIBELF64
+typedef struct {
+    Elf64_Sxword	d_tag;
+    union {
+	Elf64_Xword	d_val;
+	Elf64_Addr	d_ptr;
+    } d_un;
+} Elf64_Dyn;
+#endif /* __LIBELF64 */
+
+/*
+ * Dynamic array tags
+ */
+					/* d_un   exec	 shared */
+#define DT_NULL			0	/* ign.   mand.	 mand. */
+#define DT_NEEDED		1	/* d_val  opt.	 opt.  */
+#define DT_PLTRELSZ		2	/* d_val  opt.	 opt.  */
+#define DT_PLTGOT		3	/* d_ptr  opt.	 opt.  */
+#define DT_HASH			4	/* d_ptr  mand.	 mand. */
+#define DT_STRTAB		5	/* d_ptr  mand.	 mand. */
+#define DT_SYMTAB		6	/* d_ptr  mand.	 mand. */
+#define DT_RELA			7	/* d_ptr  mand.	 opt.  */
+#define DT_RELASZ		8	/* d_val  mand.	 opt.  */
+#define DT_RELAENT		9	/* d_val  mand.	 opt.  */
+#define DT_STRSZ		10	/* d_val  mand.	 mand. */
+#define DT_SYMENT		11	/* d_val  mand.	 mand. */
+#define DT_INIT			12	/* d_ptr  opt.	 opt.  */
+#define DT_FINI			13	/* d_ptr  opt.	 opt.  */
+#define DT_SONAME		14	/* d_val  ign.	 opt.  */
+#define DT_RPATH		15	/* d_val  opt.	 ign.  */
+#define DT_SYMBOLIC		16	/* ign.   ign.	 opt.  */
+#define DT_REL			17	/* d_ptr  mand.	 opt.  */
+#define DT_RELSZ		18	/* d_val  mand.	 opt.  */
+#define DT_RELENT		19	/* d_val  mand.	 opt.  */
+#define DT_PLTREL		20	/* d_val  opt.	 opt.  */
+#define DT_DEBUG		21	/* d_ptr  opt.	 ign.  */
+#define DT_TEXTREL		22	/* ign.   opt.	 opt.  */
+#define DT_JMPREL		23	/* d_ptr  opt.	 opt.  */
+#define DT_BIND_NOW		24	/* ign.   opt.	 opt.  */
+#define DT_INIT_ARRAY		25	/* d_ptr  opt.	 opt.  */
+#define DT_FINI_ARRAY		26	/* d_ptr  opt.	 opt.  */
+#define DT_INIT_ARRAYSZ		27	/* d_val  opt.	 opt.  */
+#define DT_FINI_ARRAYSZ		28	/* d_val  opt.	 opt.  */
+#define DT_RUNPATH		29	/* d_val  opt.	 opt.  */
+#define DT_FLAGS		30	/* d_val  opt.	 opt.  */
+#define DT_ENCODING		32	/* odd/even encoding rule starts here */
+#define DT_PREINIT_ARRAY	32	/* d_ptr  opt.	 ign.  */
+#define DT_PREINIT_ARRAYSZ	33	/* d_val  opt.	 ign.  */
+#define DT_NUM			34
+#define DT_LOOS			0x6000000D
+#define DT_HIOS			0x6ffff000
+#define DT_LOPROC		0x70000000
+#define DT_HIPROC		0x7fffffff
+
+/*
+ * DT_FLAGS values
+ */
+#define DF_ORIGIN	0x1
+#define DF_SYMBOLIC	0x2
+#define DF_TEXTREL	0x4
+#define DF_BIND_NOW	0x8
+#define DF_STATIC_TLS	0x10
+
+/*
+ * Solaris extensions
+ */
+#define DT_VALRNGLO	0x6ffffd00
+#define DT_CHECKSUM	0x6ffffdf8
+#define DT_PLTPADSZ	0x6ffffdf9
+#define DT_MOVEENT	0x6ffffdfa
+#define DT_MOVESZ	0x6ffffdfb
+#define DT_FEATURE_1	0x6ffffdfc
+#define DT_POSFLAG_1	0x6ffffdfd
+#define DT_SYMINSZ	0x6ffffdfe
+#define DT_SYMINENT	0x6ffffdff
+#define DT_VALRNGHI	0x6ffffdff
+
+#define DT_ADDRRNGLO	0x6ffffe00
+#define DT_CONFIG	0x6ffffefa
+#define DT_DEPAUDIT	0x6ffffefb
+#define DT_AUDIT	0x6ffffefc
+#define DT_PLTPAD	0x6ffffefd
+#define DT_MOVETAB	0x6ffffefe
+#define DT_SYMINFO	0x6ffffeff
+#define DT_ADDRRNGHI	0x6ffffeff
+
+#define DT_RELACOUNT	0x6ffffff9
+#define DT_RELCOUNT	0x6ffffffa
+#define DT_FLAGS_1	0x6ffffffb
+#define DT_VERDEF	0x6ffffffc
+#define DT_VERDEFNUM	0x6ffffffd
+#define DT_VERNEED	0x6ffffffe
+#define DT_VERNEEDNUM	0x6fffffff
+
+#define DT_AUXILIARY	0x7ffffffd
+#define DT_USED		0x7ffffffe
+#define DT_FILTER	0x7fffffff
+
+/*
+ * GNU extensions
+ */
+#define DT_VERSYM	0x6ffffff0
+
+/*
+ * DT_FEATURE_1 values
+ */
+#define DTF_1_PARINIT	0x1
+#define DTF_1_CONFEXP	0x2
+
+/*
+ * DT_POSFLAG_1 values
+ */
+#define DF_P1_LAZYLOAD	0x1
+#define DF_P1_GROUPPERM	0x2
+
+/*
+ * DT_FLAGS_1 values
+ */
+#define DF_1_NOW	0x00000001
+#define DF_1_GLOBAL	0x00000002
+#define DF_1_GROUP	0x00000004
+#define DF_1_NODELETE	0x00000008
+#define DF_1_LOADFLTR	0x00000010
+#define DF_1_INITFIRST	0x00000020
+#define DF_1_NOOPEN	0x00000040
+#define DF_1_ORIGIN	0x00000080
+#define DF_1_DIRECT	0x00000100
+#define DF_1_TRANS	0x00000200
+#define DF_1_INTERPOSE	0x00000400
+#define DF_1_NODEFLIB	0x00000800
+#define DF_1_NODUMP	0x00001000
+#define DF_1_CONFALT	0x00002000
+#define DF_1_ENDFILTEE	0x00004000
+#define DF_1_DISPRELDNE	0x00008000
+#define DF_1_DISPRELPND	0x00010000
+
+/*
+ * Syminfo structure
+ */
+typedef struct {
+    Elf32_Half		si_boundto;
+    Elf32_Half		si_flags;
+} Elf32_Syminfo;
+
+#if __LIBELF64
+typedef struct {
+    Elf64_Half		si_boundto;
+    Elf64_Half		si_flags;
+} Elf64_Syminfo;
+#endif /* __LIBELF64 */
+
+/*
+ * Syminfo version (stored in unused first entry)
+ */
+#define SYMINFO_NONE	0
+#define SYMINFO_CURRENT	1
+#define SYMINFO_NUM	2
+
+/*
+ * si_boundto special values
+ */
+#define SYMINFO_BT_LOWRESERVE	0xff00
+#define SYMINFO_BT_PARENT	0xfffe	/* bound to parent */
+#define SYMINFO_BT_SELF		0xffff	/* bound to self */
+
+/*
+ * si_flags
+ */
+#define SYMINFO_FLG_DIRECT	0x01	/* bound to an object */
+#define SYMINFO_FLG_PASSTHRU	0x02	/* pass-thru symbol */
+#define SYMINFO_FLG_COPY	0x04	/* result of a copy relocation */
+#define SYMINFO_FLG_LAZYLOAD	0x08	/* bound to lazy-loaded object */
+
+/*
+ * Version definitions
+ */
+typedef struct {
+    Elf32_Half		vd_version;
+    Elf32_Half		vd_flags;
+    Elf32_Half		vd_ndx;
+    Elf32_Half		vd_cnt;
+    Elf32_Word		vd_hash;
+    Elf32_Word		vd_aux;
+    Elf32_Word		vd_next;
+} Elf32_Verdef;
+
+typedef struct {
+    Elf32_Word		vda_name;
+    Elf32_Word		vda_next;
+} Elf32_Verdaux;
+
+typedef struct {
+    Elf32_Half		vn_version;
+    Elf32_Half		vn_cnt;
+    Elf32_Word		vn_file;
+    Elf32_Word		vn_aux;
+    Elf32_Word		vn_next;
+} Elf32_Verneed;
+
+typedef struct {
+    Elf32_Word		vna_hash;
+    Elf32_Half		vna_flags;
+    Elf32_Half		vna_other;
+    Elf32_Word		vna_name;
+    Elf32_Word		vna_next;
+} Elf32_Vernaux;
+
+typedef Elf32_Half	Elf32_Versym;
+
+#if __LIBELF64
+
+typedef struct {
+    Elf64_Half		vd_version;
+    Elf64_Half		vd_flags;
+    Elf64_Half		vd_ndx;
+    Elf64_Half		vd_cnt;
+    Elf64_Word		vd_hash;
+    Elf64_Word		vd_aux;
+    Elf64_Word		vd_next;
+} Elf64_Verdef;
+
+typedef struct {
+    Elf64_Word		vda_name;
+    Elf64_Word		vda_next;
+} Elf64_Verdaux;
+
+typedef struct {
+    Elf64_Half		vn_version;
+    Elf64_Half		vn_cnt;
+    Elf64_Word		vn_file;
+    Elf64_Word		vn_aux;
+    Elf64_Word		vn_next;
+} Elf64_Verneed;
+
+typedef struct {
+    Elf64_Word		vna_hash;
+    Elf64_Half		vna_flags;
+    Elf64_Half		vna_other;
+    Elf64_Word		vna_name;
+    Elf64_Word		vna_next;
+} Elf64_Vernaux;
+
+typedef Elf64_Half	Elf64_Versym;
+
+#endif /* __LIBELF64 */
+
+/*
+ * vd_version
+ */
+#define VER_DEF_NONE	0
+#define VER_DEF_CURRENT	1
+#define VER_DEF_NUM	2
+
+/*
+ * vn_version
+ */
+#define VER_NEED_NONE		0
+#define VER_NEED_CURRENT	1
+#define VER_NEED_NUM		2
+
+/*
+ * vd_flags / vna_flags
+ */
+#define VER_FLG_BASE	0x1	/* vd_flags only */
+#define VER_FLG_WEAK	0x2
+
+/*
+ * Elf*_Versym special values
+ */
+#define VER_NDX_LOCAL	0
+#define VER_NDX_GLOBAL	1
+
+/*
+ * Solaris extensions
+ */
+
+/*
+ * Move section
+ */
+#if __LIBELF64
+
+typedef struct {
+    Elf32_Lword		m_value;
+    Elf32_Word		m_info;
+    Elf32_Word		m_poffset;
+    Elf32_Half		m_repeat;
+    Elf32_Half		m_stride;
+} Elf32_Move;
+
+typedef struct {
+    Elf64_Lword		m_value;
+    Elf64_Xword		m_info;
+    Elf64_Xword		m_poffset;
+    Elf64_Half		m_repeat;
+    Elf64_Half		m_stride;
+} Elf64_Move;
+
+#define ELF32_M_SYM(info)	((info)>>8)
+#define ELF32_M_SIZE(info)	((unsigned char)(info))
+#define ELF32_M_INFO(sym, sz)	(((sym)<<8)+(unsigned char)(sz))
+
+#define ELF64_M_SYM(info)	((Elf64_Xword)(info)>>8)
+#define ELF64_M_SIZE(info)	((unsigned char)(info))
+#define ELF64_M_INFO(sym, sz)	(((Elf64_Xword)(sym)<<8)+(unsigned char)(sz))
+
+#endif /* __LIBELF64 */
+
+/*
+ * Capabilities
+ */
+
+typedef struct {
+    Elf32_Word      	c_tag;
+    union {
+	Elf32_Word      c_val;
+	Elf32_Addr      c_ptr;
+    } c_un;
+} Elf32_Cap;
+
+#if __LIBELF64
+
+typedef struct {
+    Elf64_Xword     	c_tag;
+    union {
+	Elf64_Xword     c_val;
+	Elf64_Addr      c_ptr;
+    } c_un;
+} Elf64_Cap;
+
+#endif /* __LIBELF64 */
+
+#define CA_SUNW_NULL	0	/* c_un ignored */
+#define CA_SUNW_HW_1	1	/* c_un.c_val */
+#define CA_SUNW_SF_1	2	/* c_un.c_val */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _ELF_REPL_H */

+ 118 - 0
lib/libelf/lib/end.c

@@ -0,0 +1,118 @@
+/*
+ * end.c - implementation of the elf_end(3) function.
+ * Copyright (C) 1995 - 2004 Michael Riepe
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: end.c,v 1.12 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+#if HAVE_MMAP
+#include <sys/mman.h>
+#endif /* HAVE_MMAP */
+
+static void
+_elf_free(void *ptr) {
+    if (ptr) {
+	free(ptr);
+    }
+}
+
+static void
+_elf_free_scns(Elf *elf, Elf_Scn *scn) {
+    Scn_Data *sd, *tmp;
+    Elf_Scn *freescn;
+
+    for (freescn = NULL; scn; scn = scn->s_link) {
+	elf_assert(scn->s_magic == SCN_MAGIC);
+	elf_assert(scn->s_elf == elf);
+	for (sd = scn->s_data_1; sd; sd = tmp) {
+	    elf_assert(sd->sd_magic == DATA_MAGIC);
+	    elf_assert(sd->sd_scn == scn);
+	    tmp = sd->sd_link;
+	    if (sd->sd_free_data) {
+		_elf_free(sd->sd_memdata);
+	    }
+	    if (sd->sd_freeme) {
+		free(sd);
+	    }
+	}
+	if ((sd = scn->s_rawdata)) {
+	    elf_assert(sd->sd_magic == DATA_MAGIC);
+	    elf_assert(sd->sd_scn == scn);
+	    if (sd->sd_free_data) {
+		_elf_free(sd->sd_memdata);
+	    }
+	    if (sd->sd_freeme) {
+		free(sd);
+	    }
+	}
+	if (scn->s_freeme) {
+	    _elf_free(freescn);
+	    freescn = scn;
+	}
+    }
+    _elf_free(freescn);
+}
+
+int
+elf_end(Elf *elf) {
+    Elf **siblings;
+
+    if (!elf) {
+	return 0;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    if (--elf->e_count) {
+	return elf->e_count;
+    }
+    if (elf->e_parent) {
+	elf_assert(elf->e_parent->e_magic == ELF_MAGIC);
+	elf_assert(elf->e_parent->e_kind == ELF_K_AR);
+	siblings = &elf->e_parent->e_members;
+	while (*siblings) {
+	    if (*siblings == elf) {
+		*siblings = elf->e_link;
+		break;
+	    }
+	    siblings = &(*siblings)->e_link;
+	}
+	elf_end(elf->e_parent);
+	_elf_free(elf->e_arhdr);
+    }
+#if HAVE_MMAP
+    else if (elf->e_unmap_data) {
+	munmap(elf->e_data, elf->e_size);
+    }
+#endif /* HAVE_MMAP */
+    else if (!elf->e_memory) {
+	_elf_free(elf->e_data);
+    }
+    _elf_free_scns(elf, elf->e_scn_1);
+    if (elf->e_rawdata != elf->e_data) {
+	_elf_free(elf->e_rawdata);
+    }
+    if (elf->e_free_syms) {
+	_elf_free(elf->e_symtab);
+    }
+    _elf_free(elf->e_ehdr);
+    _elf_free(elf->e_phdr);
+    free(elf);
+    return 0;
+}

+ 77 - 0
lib/libelf/lib/errmsg.c

@@ -0,0 +1,77 @@
+/*
+ * errmsg.c - implementation of the elf_errmsg(3) function.
+ * Copyright (C) 1995 - 1999, 2004 Michael Riepe
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: errmsg.c,v 1.11 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+#if HAVE_DGETTEXT
+# undef HAVE_CATGETS
+# include <libintl.h>
+#else /* HAVE_DGETTEXT */
+# define dgettext(dom, str) str
+#endif /* HAVE_DGETTEXT */
+
+#if HAVE_CATGETS
+# include <nl_types.h>
+static nl_catd _libelf_cat = (nl_catd)0;
+#endif /* HAVE_CATGETS */
+
+#if HAVE_DGETTEXT || HAVE_CATGETS
+static const char domain[] = "libelf";
+#endif /* HAVE_DGETTEXT || HAVE_CATGETS */
+
+#if PIC
+static const char *_messages[] = {
+#else /* PIC */
+static const char *const _messages[] = {
+#endif /* PIC */
+#define __err__(a,b)	b,
+#include <errors.h>		/* include string tables from errors.h */
+#undef __err__
+};
+
+const char*
+elf_errmsg(int err) {
+    if (err == 0) {
+	err = _elf_errno;
+	if (err == 0) {
+	    return NULL;
+	}
+    }
+    else if (err == -1) {
+	err = _elf_errno;
+    }
+
+    if (err < 0 || err >= ERROR_NUM || _messages[err] == NULL) {
+	err = ERROR_UNKNOWN;
+    }
+
+#if HAVE_CATGETS
+    if (_libelf_cat == (nl_catd)0) {
+	_libelf_cat = catopen(domain, 0);
+    }
+    if (_libelf_cat != (nl_catd)-1) {
+	return catgets(_libelf_cat, 1, err + 1, _messages[err]);
+    }
+#endif /* HAVE_CATGETS */
+    return dgettext(domain, _messages[err]);
+}

+ 32 - 0
lib/libelf/lib/errno.c

@@ -0,0 +1,32 @@
+/*
+errno.c - implementation of the elf_errno(3) function.
+Copyright (C) 1995 - 1998 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: errno.c,v 1.7 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+int
+elf_errno(void) {
+    int tmp = _elf_errno;
+
+    _elf_errno = 0;
+    return tmp;
+}

+ 100 - 0
lib/libelf/lib/errors.h

@@ -0,0 +1,100 @@
+/*
+ * errors.h - exhaustive list of all error codes and messages for libelf.
+ * Copyright (C) 1995 - 2003, 2006 Michael Riepe
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+/* @(#) $Id: errors.h,v 1.18 2008/05/23 08:15:34 michael Exp $ */
+
+/* dummy for xgettext */
+#define _(str) str
+
+__err__(ERROR_OK,		_("no error"))
+__err__(ERROR_UNKNOWN,		_("unknown error"))
+__err__(ERROR_INTERNAL,		_("Internal error: unknown reason"))
+__err__(ERROR_UNIMPLEMENTED,	_("Internal error: not implemented"))
+__err__(ERROR_WRONLY,		_("Request error: cntl(ELF_C_FDREAD) on write-only file"))
+__err__(ERROR_INVALID_CMD,	_("Request error: invalid ELF_C_* argument"))
+__err__(ERROR_FDDISABLED,	_("Request error: file descriptor disabled"))
+__err__(ERROR_NOTARCHIVE,	_("Request error: not an archive"))
+__err__(ERROR_BADOFF,		_("Request error: offset out of range"))
+__err__(ERROR_UNKNOWN_VERSION,	_("Request error: unknown ELF version"))
+__err__(ERROR_CMDMISMATCH,	_("Request error: ELF_C_* argument does not match"))
+__err__(ERROR_MEMBERWRITE,	_("Request error: archive member begin() for writing"))
+__err__(ERROR_FDMISMATCH,	_("Request error: archive/member file descriptor mismatch"))
+__err__(ERROR_NOTELF,		_("Request error: not an ELF file"))
+__err__(ERROR_CLASSMISMATCH,	_("Request error: class file/memory mismatch"))
+__err__(ERROR_UNKNOWN_TYPE,	_("Request error: invalid ELF_T_* argument"))
+__err__(ERROR_UNKNOWN_ENCODING,	_("Request error: unknown data encoding"))
+__err__(ERROR_DST2SMALL,	_("Request error: destination buffer too small"))
+__err__(ERROR_NULLBUF,		_("Request error: d_buf is NULL"))
+__err__(ERROR_UNKNOWN_CLASS,	_("Request error: unknown ELF class"))
+__err__(ERROR_ELFSCNMISMATCH,	_("Request error: section does not belong to file"))
+__err__(ERROR_NOSUCHSCN,	_("Request error: no section at index"))
+__err__(ERROR_NULLSCN,		_("Request error: can't manipulate null section"))
+__err__(ERROR_SCNDATAMISMATCH,	_("Request error: data does not belong to section"))
+__err__(ERROR_NOSTRTAB,		_("Request error: no string table"))
+__err__(ERROR_BADSTROFF,	_("Request error: string table offset out of range"))
+__err__(ERROR_RDONLY,		_("Request error: update(ELF_C_WRITE) on read-only file"))
+__err__(ERROR_IO_SEEK,		_("I/O error: seek"))
+__err__(ERROR_IO_2BIG,		_("I/O error: file too big for memory"))
+__err__(ERROR_IO_READ,		_("I/O error: raw read"))
+__err__(ERROR_IO_GETSIZE,	_("I/O error: get file size"))
+__err__(ERROR_IO_WRITE,		_("I/O error: output write"))
+__err__(ERROR_IO_TRUNC,		_("I/O error: can't truncate output file"))
+__err__(ERROR_VERSION_UNSET,	_("Sequence error: must set ELF version first"))
+__err__(ERROR_NOEHDR,		_("Sequence error: must create ELF header first"))
+__err__(ERROR_OUTSIDE,		_("Format error: reference outside file"))
+__err__(ERROR_TRUNC_ARHDR,	_("Format error: archive header truncated"))
+__err__(ERROR_ARFMAG,		_("Format error: archive fmag"))
+__err__(ERROR_ARHDR,		_("Format error: archive header"))
+__err__(ERROR_TRUNC_MEMBER,	_("Format error: archive member truncated"))
+__err__(ERROR_SIZE_ARSYMTAB,	_("Format error: archive symbol table size"))
+__err__(ERROR_ARSTRTAB,		_("Format error: archive string table"))
+__err__(ERROR_ARSPECIAL,	_("Format error: archive special name unknown"))
+__err__(ERROR_TRUNC_EHDR,	_("Format error: ELF header truncated"))
+__err__(ERROR_TRUNC_PHDR,	_("Format error: program header table truncated"))
+__err__(ERROR_TRUNC_SHDR,	_("Format error: section header table truncated"))
+__err__(ERROR_TRUNC_SCN,	_("Format error: data region truncated"))
+__err__(ERROR_ALIGN_PHDR,	_("Format error: program header table alignment"))
+__err__(ERROR_ALIGN_SHDR,	_("Format error: section header table alignment"))
+__err__(ERROR_VERDEF_FORMAT,	_("Format error: bad parameter in Verdef record"))
+__err__(ERROR_VERDEF_VERSION,	_("Format error: unknown Verdef version"))
+__err__(ERROR_VERNEED_FORMAT,	_("Format error: bad parameter in Verneed record"))
+__err__(ERROR_VERNEED_VERSION,	_("Format error: unknown Verneed version"))
+__err__(ERROR_EHDR_SHNUM,	_("Format error: bad e_shnum value"))
+__err__(ERROR_EHDR_SHENTSIZE,	_("Format error: bad e_shentsize value"))
+__err__(ERROR_EHDR_PHENTSIZE,	_("Format error: bad e_phentsize value"))
+__err__(ERROR_UNTERM,		_("Format error: unterminated string in string table"))
+__err__(ERROR_SCN2SMALL,	_("Layout error: section size too small for data"))
+__err__(ERROR_SCN_OVERLAP,	_("Layout error: overlapping sections"))
+__err__(ERROR_MEM_ELF,		_("Memory error: elf descriptor"))
+__err__(ERROR_MEM_ARSYMTAB,	_("Memory error: archive symbol table"))
+__err__(ERROR_MEM_ARHDR,	_("Memory error: archive member header"))
+__err__(ERROR_MEM_EHDR,		_("Memory error: ELF header"))
+__err__(ERROR_MEM_PHDR,		_("Memory error: program header table"))
+__err__(ERROR_MEM_SHDR,		_("Memory error: section header table"))
+__err__(ERROR_MEM_SCN,		_("Memory error: section descriptor"))
+__err__(ERROR_MEM_SCNDATA,	_("Memory error: section data"))
+__err__(ERROR_MEM_OUTBUF,	_("Memory error: output file space"))
+__err__(ERROR_MEM_TEMPORARY,    _("Memory error: temporary buffer"))
+__err__(ERROR_BADVALUE,		_("GElf error: value out of range"))
+__err__(ERROR_BADINDEX,		_("GElf error: index out of range"))
+__err__(ERROR_BADTYPE,		_("GElf error: type mismatch"))
+__err__(ERROR_MEM_SYM,		_("GElf error: not enough memory for GElf_Sym"))
+__err__(ERROR_MEM_DYN,		_("GElf error: not enough memory for GElf_Dyn"))
+__err__(ERROR_MEM_RELA,		_("GElf error: not enough memory for GElf_Rela"))
+__err__(ERROR_MEM_REL,		_("GElf error: not enough memory for GElf_Rel"))

+ 334 - 0
lib/libelf/lib/ext_types.h

@@ -0,0 +1,334 @@
+/*
+ext_types.h - external representation of ELF data types.
+Copyright (C) 1995 - 1998 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+/* @(#) $Id: ext_types.h,v 1.9 2008/05/23 08:15:34 michael Exp $ */
+
+#ifndef _EXT_TYPES_H
+#define _EXT_TYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Scalar data types
+ */
+typedef unsigned char __ext_Elf32_Addr  [ELF32_FSZ_ADDR];
+typedef unsigned char __ext_Elf32_Half  [ELF32_FSZ_HALF];
+typedef unsigned char __ext_Elf32_Off   [ELF32_FSZ_OFF];
+typedef unsigned char __ext_Elf32_Sword [ELF32_FSZ_SWORD];
+typedef unsigned char __ext_Elf32_Word  [ELF32_FSZ_WORD];
+
+#if __LIBELF64
+
+typedef unsigned char __ext_Elf32_Lword [8];
+
+typedef unsigned char __ext_Elf64_Addr  [ELF64_FSZ_ADDR];
+typedef unsigned char __ext_Elf64_Half  [ELF64_FSZ_HALF];
+typedef unsigned char __ext_Elf64_Off   [ELF64_FSZ_OFF];
+typedef unsigned char __ext_Elf64_Sword [ELF64_FSZ_SWORD];
+typedef unsigned char __ext_Elf64_Word  [ELF64_FSZ_WORD];
+typedef unsigned char __ext_Elf64_Sxword[ELF64_FSZ_SXWORD];
+typedef unsigned char __ext_Elf64_Xword [ELF64_FSZ_XWORD];
+
+typedef unsigned char __ext_Elf64_Lword [8];
+
+#endif /* __LIBELF64 */
+
+/*
+ * ELF header
+ */
+typedef struct {
+    unsigned char	e_ident[EI_NIDENT];
+    __ext_Elf32_Half	e_type;
+    __ext_Elf32_Half	e_machine;
+    __ext_Elf32_Word	e_version;
+    __ext_Elf32_Addr	e_entry;
+    __ext_Elf32_Off	e_phoff;
+    __ext_Elf32_Off	e_shoff;
+    __ext_Elf32_Word	e_flags;
+    __ext_Elf32_Half	e_ehsize;
+    __ext_Elf32_Half	e_phentsize;
+    __ext_Elf32_Half	e_phnum;
+    __ext_Elf32_Half	e_shentsize;
+    __ext_Elf32_Half	e_shnum;
+    __ext_Elf32_Half	e_shstrndx;
+} __ext_Elf32_Ehdr;
+
+#if __LIBELF64
+typedef struct {
+    unsigned char	e_ident[EI_NIDENT];
+    __ext_Elf64_Half	e_type;
+    __ext_Elf64_Half	e_machine;
+    __ext_Elf64_Word	e_version;
+    __ext_Elf64_Addr	e_entry;
+    __ext_Elf64_Off	e_phoff;
+    __ext_Elf64_Off	e_shoff;
+    __ext_Elf64_Word	e_flags;
+    __ext_Elf64_Half	e_ehsize;
+    __ext_Elf64_Half	e_phentsize;
+    __ext_Elf64_Half	e_phnum;
+    __ext_Elf64_Half	e_shentsize;
+    __ext_Elf64_Half	e_shnum;
+    __ext_Elf64_Half	e_shstrndx;
+} __ext_Elf64_Ehdr;
+#endif /* __LIBELF64 */
+
+/*
+ * Section header
+ */
+typedef struct {
+    __ext_Elf32_Word	sh_name;
+    __ext_Elf32_Word	sh_type;
+    __ext_Elf32_Word	sh_flags;
+    __ext_Elf32_Addr	sh_addr;
+    __ext_Elf32_Off	sh_offset;
+    __ext_Elf32_Word	sh_size;
+    __ext_Elf32_Word	sh_link;
+    __ext_Elf32_Word	sh_info;
+    __ext_Elf32_Word	sh_addralign;
+    __ext_Elf32_Word	sh_entsize;
+} __ext_Elf32_Shdr;
+
+#if __LIBELF64
+typedef struct {
+    __ext_Elf64_Word	sh_name;
+    __ext_Elf64_Word	sh_type;
+    __ext_Elf64_Xword	sh_flags;
+    __ext_Elf64_Addr	sh_addr;
+    __ext_Elf64_Off	sh_offset;
+    __ext_Elf64_Xword	sh_size;
+    __ext_Elf64_Word	sh_link;
+    __ext_Elf64_Word	sh_info;
+    __ext_Elf64_Xword	sh_addralign;
+    __ext_Elf64_Xword	sh_entsize;
+} __ext_Elf64_Shdr;
+#endif /* __LIBELF64 */
+
+/*
+ * Symbol table
+ */
+typedef struct {
+    __ext_Elf32_Word	st_name;
+    __ext_Elf32_Addr	st_value;
+    __ext_Elf32_Word	st_size;
+    unsigned char	st_info;
+    unsigned char	st_other;
+    __ext_Elf32_Half	st_shndx;
+} __ext_Elf32_Sym;
+
+#if __LIBELF64
+typedef struct {
+    __ext_Elf64_Word	st_name;
+    unsigned char	st_info;
+    unsigned char	st_other;
+    __ext_Elf64_Half	st_shndx;
+    __ext_Elf64_Addr	st_value;
+    __ext_Elf64_Xword	st_size;
+} __ext_Elf64_Sym;
+#endif /* __LIBELF64 */
+
+/*
+ * Relocation
+ */
+typedef struct {
+    __ext_Elf32_Addr	r_offset;
+    __ext_Elf32_Word	r_info;
+} __ext_Elf32_Rel;
+
+typedef struct {
+    __ext_Elf32_Addr	r_offset;
+    __ext_Elf32_Word	r_info;
+    __ext_Elf32_Sword	r_addend;
+} __ext_Elf32_Rela;
+
+#if __LIBELF64
+typedef struct {
+    __ext_Elf64_Addr	r_offset;
+#if __LIBELF64_IRIX
+    __ext_Elf64_Word	r_sym;
+    unsigned char	r_ssym;
+    unsigned char	r_type3;
+    unsigned char	r_type2;
+    unsigned char	r_type;
+#else /* __LIBELF64_IRIX */
+    __ext_Elf64_Xword	r_info;
+#endif /* __LIBELF64_IRIX */
+} __ext_Elf64_Rel;
+
+typedef struct {
+    __ext_Elf64_Addr	r_offset;
+#if __LIBELF64_IRIX
+    __ext_Elf64_Word	r_sym;
+    unsigned char	r_ssym;
+    unsigned char	r_type3;
+    unsigned char	r_type2;
+    unsigned char	r_type;
+#else /* __LIBELF64_IRIX */
+    __ext_Elf64_Xword	r_info;
+#endif /* __LIBELF64_IRIX */
+    __ext_Elf64_Sxword	r_addend;
+} __ext_Elf64_Rela;
+#endif /* __LIBELF64 */
+
+/*
+ * Program header
+ */
+typedef struct {
+    __ext_Elf32_Word	p_type;
+    __ext_Elf32_Off	p_offset;
+    __ext_Elf32_Addr	p_vaddr;
+    __ext_Elf32_Addr	p_paddr;
+    __ext_Elf32_Word	p_filesz;
+    __ext_Elf32_Word	p_memsz;
+    __ext_Elf32_Word	p_flags;
+    __ext_Elf32_Word	p_align;
+} __ext_Elf32_Phdr;
+
+#if __LIBELF64
+typedef struct {
+    __ext_Elf64_Word	p_type;
+    __ext_Elf64_Word	p_flags;
+    __ext_Elf64_Off	p_offset;
+    __ext_Elf64_Addr	p_vaddr;
+    __ext_Elf64_Addr	p_paddr;
+    __ext_Elf64_Xword	p_filesz;
+    __ext_Elf64_Xword	p_memsz;
+    __ext_Elf64_Xword	p_align;
+} __ext_Elf64_Phdr;
+#endif /* __LIBELF64 */
+
+/*
+ * Dynamic structure
+ */
+typedef struct {
+    __ext_Elf32_Sword	d_tag;
+    union {
+	__ext_Elf32_Word	d_val;
+	__ext_Elf32_Addr	d_ptr;
+    } d_un;
+} __ext_Elf32_Dyn;
+
+#if __LIBELF64
+typedef struct {
+    __ext_Elf64_Sxword	d_tag;
+    union {
+	__ext_Elf64_Xword	d_val;
+	__ext_Elf64_Addr	d_ptr;
+    } d_un;
+} __ext_Elf64_Dyn;
+#endif /* __LIBELF64 */
+
+/*
+ * Version definitions
+ */
+typedef struct {
+    __ext_Elf32_Half	vd_version;
+    __ext_Elf32_Half	vd_flags;
+    __ext_Elf32_Half	vd_ndx;
+    __ext_Elf32_Half	vd_cnt;
+    __ext_Elf32_Word	vd_hash;
+    __ext_Elf32_Word	vd_aux;
+    __ext_Elf32_Word	vd_next;
+} __ext_Elf32_Verdef;
+
+typedef struct {
+    __ext_Elf32_Word	vda_name;
+    __ext_Elf32_Word	vda_next;
+} __ext_Elf32_Verdaux;
+
+typedef struct {
+    __ext_Elf32_Half	vn_version;
+    __ext_Elf32_Half	vn_cnt;
+    __ext_Elf32_Word	vn_file;
+    __ext_Elf32_Word	vn_aux;
+    __ext_Elf32_Word	vn_next;
+} __ext_Elf32_Verneed;
+
+typedef struct {
+    __ext_Elf32_Word	vna_hash;
+    __ext_Elf32_Half	vna_flags;
+    __ext_Elf32_Half	vna_other;
+    __ext_Elf32_Word	vna_name;
+    __ext_Elf32_Word	vna_next;
+} __ext_Elf32_Vernaux;
+
+#if __LIBELF64
+
+typedef struct {
+    __ext_Elf64_Half	vd_version;
+    __ext_Elf64_Half	vd_flags;
+    __ext_Elf64_Half	vd_ndx;
+    __ext_Elf64_Half	vd_cnt;
+    __ext_Elf64_Word	vd_hash;
+    __ext_Elf64_Word	vd_aux;
+    __ext_Elf64_Word	vd_next;
+} __ext_Elf64_Verdef;
+
+typedef struct {
+    __ext_Elf64_Word	vda_name;
+    __ext_Elf64_Word	vda_next;
+} __ext_Elf64_Verdaux;
+
+typedef struct {
+    __ext_Elf64_Half	vn_version;
+    __ext_Elf64_Half	vn_cnt;
+    __ext_Elf64_Word	vn_file;
+    __ext_Elf64_Word	vn_aux;
+    __ext_Elf64_Word	vn_next;
+} __ext_Elf64_Verneed;
+
+typedef struct {
+    __ext_Elf64_Word	vna_hash;
+    __ext_Elf64_Half	vna_flags;
+    __ext_Elf64_Half	vna_other;
+    __ext_Elf64_Word	vna_name;
+    __ext_Elf64_Word	vna_next;
+} __ext_Elf64_Vernaux;
+
+#endif /* __LIBELF64 */
+
+/*
+ * Move section
+ */
+#if __LIBELF64
+
+typedef struct {
+    __ext_Elf32_Lword	m_value;
+    __ext_Elf32_Word	m_info;
+    __ext_Elf32_Word	m_poffset;
+    __ext_Elf32_Half	m_repeat;
+    __ext_Elf32_Half	m_stride;
+} __ext_Elf32_Move;
+
+typedef struct {
+    __ext_Elf64_Lword	m_value;
+    __ext_Elf64_Xword	m_info;
+    __ext_Elf64_Xword	m_poffset;
+    __ext_Elf64_Half	m_repeat;
+    __ext_Elf64_Half	m_stride;
+} __ext_Elf64_Move;
+
+#endif /* __LIBELF64 */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _EXT_TYPES_H */

+ 29 - 0
lib/libelf/lib/fill.c

@@ -0,0 +1,29 @@
+/*
+fill.c - implementation of the elf_fill(3) function.
+Copyright (C) 1995 - 1998 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: fill.c,v 1.7 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+void
+elf_fill(int fill) {
+    _elf_fill = fill;
+}

+ 92 - 0
lib/libelf/lib/flag.c

@@ -0,0 +1,92 @@
+/*
+flag.c - implementation of the elf_flag*(3) functions.
+Copyright (C) 1995 - 1998 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: flag.c,v 1.7 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+static unsigned
+_elf_flag(unsigned *f, Elf_Cmd cmd, unsigned flags) {
+    if (cmd == ELF_C_SET) {
+	return *f |= flags;
+    }
+    if (cmd == ELF_C_CLR) {
+	return *f &= ~flags;
+    }
+    seterr(ERROR_INVALID_CMD);
+    return 0;
+}
+
+unsigned
+elf_flagdata(Elf_Data *data, Elf_Cmd cmd, unsigned flags) {
+    Scn_Data *sd = (Scn_Data*)data;
+
+    if (!sd) {
+	return 0;
+    }
+    elf_assert(sd->sd_magic == DATA_MAGIC);
+    return _elf_flag(&sd->sd_data_flags, cmd, flags);
+}
+
+unsigned
+elf_flagehdr(Elf *elf, Elf_Cmd cmd, unsigned flags) {
+    if (!elf) {
+	return 0;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    return _elf_flag(&elf->e_ehdr_flags, cmd, flags);
+}
+
+unsigned
+elf_flagelf(Elf *elf, Elf_Cmd cmd, unsigned flags) {
+    if (!elf) {
+	return 0;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    return _elf_flag(&elf->e_elf_flags, cmd, flags);
+}
+
+unsigned
+elf_flagphdr(Elf *elf, Elf_Cmd cmd, unsigned flags) {
+    if (!elf) {
+	return 0;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    return _elf_flag(&elf->e_phdr_flags, cmd, flags);
+}
+
+unsigned
+elf_flagscn(Elf_Scn *scn, Elf_Cmd cmd, unsigned flags) {
+    if (!scn) {
+	return 0;
+    }
+    elf_assert(scn->s_magic == SCN_MAGIC);
+    return _elf_flag(&scn->s_scn_flags, cmd, flags);
+}
+
+unsigned
+elf_flagshdr(Elf_Scn *scn, Elf_Cmd cmd, unsigned flags) {
+    if (!scn) {
+	return 0;
+    }
+    elf_assert(scn->s_magic == SCN_MAGIC);
+    return _elf_flag(&scn->s_shdr_flags, cmd, flags);
+}

+ 155 - 0
lib/libelf/lib/gelf.h

@@ -0,0 +1,155 @@
+/*
+ * gelf.h - public header file for libelf.
+ * Copyright (C) 2000 - 2006 Michael Riepe
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+/* @(#) $Id: gelf.h,v 1.16 2008/05/23 08:15:34 michael Exp $ */
+
+#ifndef _GELF_H
+#define _GELF_H
+
+#if __LIBELF_INTERNAL__
+#include <libelf.h>
+#else /* __LIBELF_INTERNAL__ */
+#include <libelf/libelf.h>
+#endif /* __LIBELF_INTERNAL__ */
+
+#if __LIBELF_NEED_LINK_H
+#include <link.h>
+#elif __LIBELF_NEED_SYS_LINK_H
+#include <sys/link.h>
+#endif /* __LIBELF_NEED_LINK_H */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifndef __P
+# if (__STDC__ + 0) || defined(__cplusplus) || defined(_WIN32)
+#  define __P(args) args
+# else /* __STDC__ || defined(__cplusplus) */
+#  define __P(args) ()
+# endif /* __STDC__ || defined(__cplusplus) */
+#endif /* __P */
+
+#if !__LIBELF64
+
+#error "GElf is not supported on this system."
+
+#else /* __LIBELF64 */
+
+typedef Elf64_Addr	GElf_Addr;
+typedef Elf64_Half	GElf_Half;
+typedef Elf64_Off	GElf_Off;
+typedef Elf64_Sword	GElf_Sword;
+typedef Elf64_Word	GElf_Word;
+typedef Elf64_Sxword	GElf_Sxword;
+typedef Elf64_Xword	GElf_Xword;
+
+typedef Elf64_Ehdr	GElf_Ehdr;
+typedef Elf64_Phdr	GElf_Phdr;
+typedef Elf64_Shdr	GElf_Shdr;
+typedef Elf64_Dyn	GElf_Dyn;
+typedef Elf64_Rel	GElf_Rel;
+typedef Elf64_Rela	GElf_Rela;
+typedef Elf64_Sym	GElf_Sym;
+
+/*
+ * Symbol versioning
+ */
+#if __LIBELF_SYMBOL_VERSIONS
+typedef Elf64_Verdef	GElf_Verdef;
+typedef Elf64_Verneed	GElf_Verneed;
+typedef Elf64_Verdaux	GElf_Verdaux;
+typedef Elf64_Vernaux	GElf_Vernaux;
+#endif /* __LIBELF_SYMBOL_VERSIONS */
+
+/*
+ * These types aren't implemented (yet)
+ *
+typedef Elf64_Move    GElf_Move;
+typedef Elf64_Syminfo GElf_Syminfo;
+ */
+
+/*
+ * Generic macros
+ */
+#define GELF_ST_BIND	ELF64_ST_BIND
+#define GELF_ST_TYPE	ELF64_ST_TYPE
+#define GELF_ST_INFO	ELF64_ST_INFO
+
+#define GELF_R_TYPE	ELF64_R_TYPE
+#define GELF_R_SYM	ELF64_R_SYM
+#define GELF_R_INFO	ELF64_R_INFO
+
+/*
+ * Function declarations
+ */
+extern int             gelf_getclass __P((Elf *__elf));
+
+extern size_t             gelf_fsize __P((Elf *__elf, Elf_Type __type, size_t __count, unsigned __ver));
+
+extern Elf_Data       *gelf_xlatetof __P((Elf *__elf, Elf_Data *__dst, const Elf_Data *__src, unsigned __encode));
+extern Elf_Data       *gelf_xlatetom __P((Elf *__elf, Elf_Data *__dst, const Elf_Data *__src, unsigned __encode));
+
+extern GElf_Ehdr       *gelf_getehdr __P((Elf *__elf, GElf_Ehdr *__dst));
+extern int          gelf_update_ehdr __P((Elf *__elf, GElf_Ehdr *__src));
+extern unsigned long    gelf_newehdr __P((Elf *__elf, int __elfclass));
+
+extern GElf_Phdr       *gelf_getphdr __P((Elf *__elf, int ndx, GElf_Phdr *__dst));
+extern int          gelf_update_phdr __P((Elf *__elf, int ndx, GElf_Phdr *__src));
+extern unsigned long    gelf_newphdr __P((Elf *__elf, size_t __phnum));
+
+extern GElf_Shdr       *gelf_getshdr __P((Elf_Scn *__scn, GElf_Shdr *__dst));
+extern int          gelf_update_shdr __P((Elf_Scn *__scn, GElf_Shdr *__src));
+
+extern GElf_Dyn         *gelf_getdyn __P((Elf_Data *__src, int __ndx, GElf_Dyn *__dst));
+extern int           gelf_update_dyn __P((Elf_Data *__dst, int __ndx, GElf_Dyn *__src));
+
+extern GElf_Rel         *gelf_getrel __P((Elf_Data *__src, int __ndx, GElf_Rel *__dst));
+extern int           gelf_update_rel __P((Elf_Data *__dst, int __ndx, GElf_Rel *__src));
+
+extern GElf_Rela       *gelf_getrela __P((Elf_Data *__src, int __ndx, GElf_Rela *__dst));
+extern int          gelf_update_rela __P((Elf_Data *__dst, int __ndx, GElf_Rela *__src));
+
+extern GElf_Sym         *gelf_getsym __P((Elf_Data *__src, int __ndx, GElf_Sym *__dst));
+extern int           gelf_update_sym __P((Elf_Data *__dst, int __ndx, GElf_Sym *__src));
+
+extern long            gelf_checksum __P((Elf *__elf));
+
+/*
+ * These functions aren't implemented (yet)
+ *
+extern GElf_Move       *gelf_getmove __P((Elf_Data *__src, int __ndx, GElf_Move *__src));
+extern int          gelf_update_move __P((Elf_Data *__dst, int __ndx, GElf_Move *__src));
+ *
+extern GElf_Syminfo* gelf_getsyminfo __P((Elf_Data *__src, int __ndx, GElf_Syminfo *__dst));
+extern int       gelf_update_syminfo __P((Elf_Data *__dst, int __ndx, GElf_Syminfo *__src));
+ */
+
+/*
+ * Extensions (not available in other versions of libelf)
+ */
+extern size_t             gelf_msize __P((Elf *__elf, Elf_Type __type, size_t __count, unsigned __ver));
+
+#endif /* __LIBELF64 */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _GELF_H */

+ 140 - 0
lib/libelf/lib/gelfehdr.c

@@ -0,0 +1,140 @@
+/*
+ * gelfehdr.c - gelf_* translation functions.
+ * Copyright (C) 2000 - 2006 Michael Riepe
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <private.h>
+
+#if __LIBELF64
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: gelfehdr.c,v 1.9 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+#define check_and_copy(type, d, s, name, eret)		\
+    do {						\
+	if (sizeof((d)->name) < sizeof((s)->name)	\
+	 && (type)(s)->name != (s)->name) {		\
+	    seterr(ERROR_BADVALUE);			\
+	    return (eret);				\
+	}						\
+	(d)->name = (type)(s)->name;			\
+    } while (0)
+
+GElf_Ehdr*
+gelf_getehdr(Elf *elf, GElf_Ehdr *dst) {
+    GElf_Ehdr buf;
+    char *tmp;
+
+    if (!elf) {
+	return NULL;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    tmp = _elf_getehdr(elf, elf->e_class);
+    if (!tmp) {
+	return NULL;
+    }
+    if (!dst) {
+	dst = &buf;
+    }
+    if (elf->e_class == ELFCLASS64) {
+	*dst = *(Elf64_Ehdr*)tmp;
+    }
+    else if (elf->e_class == ELFCLASS32) {
+	Elf32_Ehdr *src = (Elf32_Ehdr*)tmp;
+
+	memcpy(dst->e_ident, src->e_ident, EI_NIDENT);
+	check_and_copy(GElf_Half, dst, src, e_type,      NULL);
+	check_and_copy(GElf_Half, dst, src, e_machine,   NULL);
+	check_and_copy(GElf_Word, dst, src, e_version,   NULL);
+	check_and_copy(GElf_Addr, dst, src, e_entry,     NULL);
+	check_and_copy(GElf_Off,  dst, src, e_phoff,     NULL);
+	check_and_copy(GElf_Off,  dst, src, e_shoff,     NULL);
+	check_and_copy(GElf_Word, dst, src, e_flags,     NULL);
+	check_and_copy(GElf_Half, dst, src, e_ehsize,    NULL);
+	check_and_copy(GElf_Half, dst, src, e_phentsize, NULL);
+	check_and_copy(GElf_Half, dst, src, e_phnum,     NULL);
+	check_and_copy(GElf_Half, dst, src, e_shentsize, NULL);
+	check_and_copy(GElf_Half, dst, src, e_shnum,     NULL);
+	check_and_copy(GElf_Half, dst, src, e_shstrndx,  NULL);
+    }
+    else {
+	if (valid_class(elf->e_class)) {
+	    seterr(ERROR_UNIMPLEMENTED);
+	}
+	else {
+	    seterr(ERROR_UNKNOWN_CLASS);
+	}
+	return NULL;
+    }
+    if (dst == &buf) {
+	dst = (GElf_Ehdr*)malloc(sizeof(GElf_Ehdr));
+	if (!dst) {
+	    seterr(ERROR_MEM_EHDR);
+	    return NULL;
+	}
+	*dst = buf;
+    }
+    return dst;
+}
+
+int
+gelf_update_ehdr(Elf *elf, GElf_Ehdr *src) {
+    char *tmp;
+
+    if (!elf || !src) {
+	return 0;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    tmp = _elf_getehdr(elf, elf->e_class);
+    if (!tmp) {
+	return 0;
+    }
+    if (elf->e_class == ELFCLASS64) {
+	*(Elf64_Ehdr*)tmp = *src;
+    }
+    else if (elf->e_class == ELFCLASS32) {
+	Elf32_Ehdr *dst = (Elf32_Ehdr*)tmp;
+
+	memcpy(dst->e_ident, src->e_ident, EI_NIDENT);
+	check_and_copy(Elf32_Half, dst, src, e_type,      0);
+	check_and_copy(Elf32_Half, dst, src, e_machine,   0);
+	check_and_copy(Elf32_Word, dst, src, e_version,   0);
+	check_and_copy(Elf32_Addr, dst, src, e_entry,     0);
+	check_and_copy(Elf32_Off,  dst, src, e_phoff,     0);
+	check_and_copy(Elf32_Off,  dst, src, e_shoff,     0);
+	check_and_copy(Elf32_Word, dst, src, e_flags,     0);
+	check_and_copy(Elf32_Half, dst, src, e_ehsize,    0);
+	check_and_copy(Elf32_Half, dst, src, e_phentsize, 0);
+	check_and_copy(Elf32_Half, dst, src, e_phnum,     0);
+	check_and_copy(Elf32_Half, dst, src, e_shentsize, 0);
+	check_and_copy(Elf32_Half, dst, src, e_shnum,     0);
+	check_and_copy(Elf32_Half, dst, src, e_shstrndx,  0);
+    }
+    else {
+	if (valid_class(elf->e_class)) {
+	    seterr(ERROR_UNIMPLEMENTED);
+	}
+	else {
+	    seterr(ERROR_UNKNOWN_CLASS);
+	}
+	return 0;
+    }
+    return 1;
+}
+
+#endif /* __LIBELF64 */

+ 148 - 0
lib/libelf/lib/gelfphdr.c

@@ -0,0 +1,148 @@
+/*
+ * gelfphdr.c - gelf_* translation functions.
+ * Copyright (C) 2000 - 2006 Michael Riepe
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <private.h>
+
+#if __LIBELF64
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: gelfphdr.c,v 1.9 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+#define check_and_copy(type, d, s, name, eret)		\
+    do {						\
+	if (sizeof((d)->name) < sizeof((s)->name)	\
+	 && (type)(s)->name != (s)->name) {		\
+	    seterr(ERROR_BADVALUE);			\
+	    return (eret);				\
+	}						\
+	(d)->name = (type)(s)->name;			\
+    } while (0)
+
+GElf_Phdr*
+gelf_getphdr(Elf *elf, int ndx, GElf_Phdr *dst) {
+    GElf_Phdr buf;
+    char *tmp;
+    size_t n;
+
+    if (!elf) {
+	return NULL;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    tmp = _elf_getphdr(elf, elf->e_class);
+    if (!tmp) {
+	return NULL;
+    }
+    if (ndx < 0 || ndx >= elf->e_phnum) {
+	seterr(ERROR_BADINDEX);
+	return NULL;
+    }
+    n = _msize(elf->e_class, _elf_version, ELF_T_PHDR);
+    if (n == 0) {
+	seterr(ERROR_UNIMPLEMENTED);
+	return NULL;
+    }
+    if (!dst) {
+	dst = &buf;
+    }
+    if (elf->e_class == ELFCLASS64) {
+	*dst = *(Elf64_Phdr*)(tmp + ndx * n);
+    }
+    else if (elf->e_class == ELFCLASS32) {
+	Elf32_Phdr *src = (Elf32_Phdr*)(tmp + ndx * n);
+
+	check_and_copy(GElf_Word,  dst, src, p_type,   NULL);
+	check_and_copy(GElf_Word,  dst, src, p_flags,  NULL);
+	check_and_copy(GElf_Off,   dst, src, p_offset, NULL);
+	check_and_copy(GElf_Addr,  dst, src, p_vaddr,  NULL);
+	check_and_copy(GElf_Addr,  dst, src, p_paddr,  NULL);
+	check_and_copy(GElf_Xword, dst, src, p_filesz, NULL);
+	check_and_copy(GElf_Xword, dst, src, p_memsz,  NULL);
+	check_and_copy(GElf_Xword, dst, src, p_align,  NULL);
+    }
+    else {
+	if (valid_class(elf->e_class)) {
+	    seterr(ERROR_UNIMPLEMENTED);
+	}
+	else {
+	    seterr(ERROR_UNKNOWN_CLASS);
+	}
+	return NULL;
+    }
+    if (dst == &buf) {
+	dst = (GElf_Phdr*)malloc(sizeof(GElf_Phdr));
+	if (!dst) {
+	    seterr(ERROR_MEM_PHDR);
+	    return NULL;
+	}
+	*dst = buf;
+    }
+    return dst;
+}
+
+int
+gelf_update_phdr(Elf *elf, int ndx, GElf_Phdr *src) {
+    char *tmp;
+    size_t n;
+
+    if (!elf || !src) {
+	return 0;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    tmp = _elf_getphdr(elf, elf->e_class);
+    if (!tmp) {
+	return 0;
+    }
+    if (ndx < 0 || ndx >= elf->e_phnum) {
+	seterr(ERROR_BADINDEX);
+	return 0;
+    }
+    n = _msize(elf->e_class, _elf_version, ELF_T_PHDR);
+    if (n == 0) {
+	seterr(ERROR_UNIMPLEMENTED);
+	return 0;
+    }
+    if (elf->e_class == ELFCLASS64) {
+	*(Elf64_Phdr*)(tmp + ndx * n) = *src;
+    }
+    else if (elf->e_class == ELFCLASS32) {
+	Elf32_Phdr *dst = (Elf32_Phdr*)(tmp + ndx * n);
+
+	check_and_copy(Elf32_Word, dst, src, p_type,   0);
+	check_and_copy(Elf32_Off,  dst, src, p_offset, 0);
+	check_and_copy(Elf32_Addr, dst, src, p_vaddr,  0);
+	check_and_copy(Elf32_Addr, dst, src, p_paddr,  0);
+	check_and_copy(Elf32_Word, dst, src, p_filesz, 0);
+	check_and_copy(Elf32_Word, dst, src, p_memsz,  0);
+	check_and_copy(Elf32_Word, dst, src, p_flags,  0);
+	check_and_copy(Elf32_Word, dst, src, p_align,  0);
+    }
+    else {
+	if (valid_class(elf->e_class)) {
+	    seterr(ERROR_UNIMPLEMENTED);
+	}
+	else {
+	    seterr(ERROR_UNKNOWN_CLASS);
+	}
+	return 0;
+    }
+    return 1;
+}
+
+#endif /* __LIBELF64 */

+ 125 - 0
lib/libelf/lib/gelfshdr.c

@@ -0,0 +1,125 @@
+/*
+ * gelfshdr.c - gelf_* translation functions.
+ * Copyright (C) 2000 - 2006 Michael Riepe
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <private.h>
+
+#if __LIBELF64
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: gelfshdr.c,v 1.10 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+#define check_and_copy(type, d, s, name, eret)		\
+    do {						\
+	if (sizeof((d)->name) < sizeof((s)->name)	\
+	 && (type)(s)->name != (s)->name) {		\
+	    seterr(ERROR_BADVALUE);			\
+	    return (eret);				\
+	}						\
+	(d)->name = (type)(s)->name;			\
+    } while (0)
+
+GElf_Shdr*
+gelf_getshdr(Elf_Scn *scn, GElf_Shdr *dst) {
+    GElf_Shdr buf;
+
+    if (!scn) {
+	return NULL;
+    }
+    elf_assert(scn->s_magic == SCN_MAGIC);
+    elf_assert(scn->s_elf);
+    elf_assert(scn->s_elf->e_magic == ELF_MAGIC);
+    if (!dst) {
+	dst = &buf;
+    }
+    if (scn->s_elf->e_class == ELFCLASS64) {
+	*dst = scn->s_shdr64;
+    }
+    else if (scn->s_elf->e_class == ELFCLASS32) {
+	Elf32_Shdr *src = &scn->s_shdr32;
+
+	check_and_copy(GElf_Word,  dst, src, sh_name,      NULL);
+	check_and_copy(GElf_Word,  dst, src, sh_type,      NULL);
+	check_and_copy(GElf_Xword, dst, src, sh_flags,     NULL);
+	check_and_copy(GElf_Addr,  dst, src, sh_addr,      NULL);
+	check_and_copy(GElf_Off,   dst, src, sh_offset,    NULL);
+	check_and_copy(GElf_Xword, dst, src, sh_size,      NULL);
+	check_and_copy(GElf_Word,  dst, src, sh_link,      NULL);
+	check_and_copy(GElf_Word,  dst, src, sh_info,      NULL);
+	check_and_copy(GElf_Xword, dst, src, sh_addralign, NULL);
+	check_and_copy(GElf_Xword, dst, src, sh_entsize,   NULL);
+    }
+    else {
+	if (valid_class(scn->s_elf->e_class)) {
+	    seterr(ERROR_UNIMPLEMENTED);
+	}
+	else {
+	    seterr(ERROR_UNKNOWN_CLASS);
+	}
+	return NULL;
+    }
+    if (dst == &buf) {
+	dst = (GElf_Shdr*)malloc(sizeof(GElf_Shdr));
+	if (!dst) {
+	    seterr(ERROR_MEM_SHDR);
+	    return NULL;
+	}
+	*dst = buf;
+    }
+    return dst;
+}
+
+int
+gelf_update_shdr(Elf_Scn *scn, GElf_Shdr *src) {
+    if (!scn || !src) {
+	return 0;
+    }
+    elf_assert(scn->s_magic == SCN_MAGIC);
+    elf_assert(scn->s_elf);
+    elf_assert(scn->s_elf->e_magic == ELF_MAGIC);
+    if (scn->s_elf->e_class == ELFCLASS64) {
+	scn->s_shdr64 = *src;
+    }
+    else if (scn->s_elf->e_class == ELFCLASS32) {
+	Elf32_Shdr *dst = &scn->s_shdr32;
+
+	check_and_copy(Elf32_Word, dst, src, sh_name,      0);
+	check_and_copy(Elf32_Word, dst, src, sh_type,      0);
+	check_and_copy(Elf32_Word, dst, src, sh_flags,     0);
+	check_and_copy(Elf32_Addr, dst, src, sh_addr,      0);
+	check_and_copy(Elf32_Off,  dst, src, sh_offset,    0);
+	check_and_copy(Elf32_Word, dst, src, sh_size,      0);
+	check_and_copy(Elf32_Word, dst, src, sh_link,      0);
+	check_and_copy(Elf32_Word, dst, src, sh_info,      0);
+	check_and_copy(Elf32_Word, dst, src, sh_addralign, 0);
+	check_and_copy(Elf32_Word, dst, src, sh_entsize,   0);
+    }
+    else {
+	if (valid_class(scn->s_elf->e_class)) {
+	    seterr(ERROR_UNIMPLEMENTED);
+	}
+	else {
+	    seterr(ERROR_UNKNOWN_CLASS);
+	}
+	return 0;
+    }
+    return 1;
+}
+
+#endif /* __LIBELF64 */

+ 407 - 0
lib/libelf/lib/gelftrans.c

@@ -0,0 +1,407 @@
+/*
+gelftrans.c - gelf_* translation functions.
+Copyright (C) 2000 - 2001 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#if __LIBELF64
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: gelftrans.c,v 1.10 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+#define check_and_copy(type, d, s, name, eret)		\
+    do {						\
+	if (sizeof((d)->name) < sizeof((s)->name)	\
+	 && (type)(s)->name != (s)->name) {		\
+	    seterr(ERROR_BADVALUE);			\
+	    return (eret);				\
+	}						\
+	(d)->name = (type)(s)->name;			\
+    } while (0)
+
+/*
+ * These macros are missing on some Linux systems
+ */
+#if !defined(ELF32_R_SYM) || !defined(ELF32_R_TYPE) || !defined(ELF32_R_INFO)
+# undef ELF32_R_SYM
+# undef ELF32_R_TYPE
+# undef ELF32_R_INFO
+# define ELF32_R_SYM(i)		((i)>>8)
+# define ELF32_R_TYPE(i)	((unsigned char)(i))
+# define ELF32_R_INFO(s,t)	(((s)<<8)+(unsigned char)(t))
+#endif /* !defined(...) */
+
+#if !defined(ELF64_R_SYM) || !defined(ELF64_R_TYPE) || !defined(ELF64_R_INFO)
+# undef ELF64_R_SYM
+# undef ELF64_R_TYPE
+# undef ELF64_R_INFO
+# define ELF64_R_SYM(i)		((i)>>32)
+# define ELF64_R_TYPE(i)	((i)&0xffffffffL)
+# define ELF64_R_INFO(s,t)	(((Elf64_Xword)(s)<<32)+((t)&0xffffffffL))
+#endif /* !defined(...) */
+
+static char*
+get_addr_and_class(const Elf_Data *data, int ndx, Elf_Type type, unsigned *cls) {
+    Scn_Data *sd = (Scn_Data*)data;
+    Elf_Scn *scn;
+    Elf *elf;
+    size_t n;
+
+    if (!sd) {
+	return NULL;
+    }
+    elf_assert(sd->sd_magic == DATA_MAGIC);
+    scn = sd->sd_scn;
+    elf_assert(scn);
+    elf_assert(scn->s_magic == SCN_MAGIC);
+    elf = scn->s_elf;
+    elf_assert(elf);
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    if (elf->e_kind != ELF_K_ELF) {
+	seterr(ERROR_NOTELF);
+	return NULL;
+    }
+    if (!valid_class(elf->e_class)) {
+	seterr(ERROR_UNKNOWN_CLASS);
+	return NULL;
+    }
+    if (data->d_type != type) {
+	seterr(ERROR_BADTYPE);
+	return NULL;
+    }
+    n = _msize(elf->e_class, data->d_version, type);
+    if (n == 0) {
+	seterr(ERROR_UNIMPLEMENTED);
+	return NULL;
+    }
+    if (ndx < 0 || data->d_size < (ndx + 1) * n) {
+	seterr(ERROR_BADINDEX);
+	return NULL;
+    }
+    if (!data->d_buf) {
+	seterr(ERROR_NULLBUF);
+	return NULL;
+    }
+    if (cls) {
+	*cls = elf->e_class;
+    }
+    return (char*)data->d_buf + n * ndx;
+}
+
+GElf_Sym*
+gelf_getsym(Elf_Data *src, int ndx, GElf_Sym *dst) {
+    GElf_Sym buf;
+    unsigned cls;
+    char *tmp;
+
+    if (!dst) {
+	dst = &buf;
+    }
+    tmp = get_addr_and_class(src, ndx, ELF_T_SYM, &cls);
+    if (!tmp) {
+	return NULL;
+    }
+    if (cls == ELFCLASS64) {
+	*dst = *(Elf64_Sym*)tmp;
+    }
+    else if (cls == ELFCLASS32) {
+	Elf32_Sym *src = (Elf32_Sym*)tmp;
+
+	check_and_copy(GElf_Word,     dst, src, st_name,  NULL);
+	check_and_copy(unsigned char, dst, src, st_info,  NULL);
+	check_and_copy(unsigned char, dst, src, st_other, NULL);
+	check_and_copy(GElf_Half,     dst, src, st_shndx, NULL);
+	check_and_copy(GElf_Addr,     dst, src, st_value, NULL);
+	check_and_copy(GElf_Xword,    dst, src, st_size,  NULL);
+    }
+    else {
+	seterr(ERROR_UNIMPLEMENTED);
+	return NULL;
+    }
+    if (dst == &buf) {
+	dst = (GElf_Sym*)malloc(sizeof(GElf_Sym));
+	if (!dst) {
+	    seterr(ERROR_MEM_SYM);
+	    return NULL;
+	}
+	*dst = buf;
+    }
+    return dst;
+}
+
+int
+gelf_update_sym(Elf_Data *dst, int ndx, GElf_Sym *src) {
+    unsigned cls;
+    char *tmp;
+
+    tmp = get_addr_and_class(dst, ndx, ELF_T_SYM, &cls);
+    if (!tmp) {
+	return 0;
+    }
+    if (cls == ELFCLASS64) {
+	*(Elf64_Sym*)tmp = *src;
+    }
+    else if (cls == ELFCLASS32) {
+	Elf32_Sym *dst = (Elf32_Sym*)tmp;
+
+	check_and_copy(Elf32_Word,    dst, src, st_name,  0);
+	check_and_copy(Elf32_Addr,    dst, src, st_value, 0);
+	check_and_copy(Elf32_Word,    dst, src, st_size,  0);
+	check_and_copy(unsigned char, dst, src, st_info,  0);
+	check_and_copy(unsigned char, dst, src, st_other, 0);
+	check_and_copy(Elf32_Half,    dst, src, st_shndx, 0);
+    }
+    else {
+	seterr(ERROR_UNIMPLEMENTED);
+	return 0;
+    }
+    return 1;
+}
+
+GElf_Dyn*
+gelf_getdyn(Elf_Data *src, int ndx, GElf_Dyn *dst) {
+    GElf_Dyn buf;
+    unsigned cls;
+    char *tmp;
+
+    if (!dst) {
+	dst = &buf;
+    }
+    tmp = get_addr_and_class(src, ndx, ELF_T_DYN, &cls);
+    if (!tmp) {
+	return NULL;
+    }
+    if (cls == ELFCLASS64) {
+	*dst = *(Elf64_Dyn*)tmp;
+    }
+    else if (cls == ELFCLASS32) {
+	Elf32_Dyn *src = (Elf32_Dyn*)tmp;
+
+	check_and_copy(GElf_Sxword, dst, src, d_tag,      NULL);
+	check_and_copy(GElf_Xword,  dst, src, d_un.d_val, NULL);
+    }
+    else {
+	seterr(ERROR_UNIMPLEMENTED);
+	return NULL;
+    }
+    if (dst == &buf) {
+	dst = (GElf_Dyn*)malloc(sizeof(GElf_Dyn));
+	if (!dst) {
+	    seterr(ERROR_MEM_DYN);
+	    return NULL;
+	}
+	*dst = buf;
+    }
+    return dst;
+}
+
+int
+gelf_update_dyn(Elf_Data *dst, int ndx, GElf_Dyn *src) {
+    unsigned cls;
+    char *tmp;
+
+    tmp = get_addr_and_class(dst, ndx, ELF_T_DYN, &cls);
+    if (!tmp) {
+	return 0;
+    }
+    if (cls == ELFCLASS64) {
+	*(Elf64_Dyn*)tmp = *src;
+    }
+    else if (cls == ELFCLASS32) {
+	Elf32_Dyn *dst = (Elf32_Dyn*)tmp;
+
+	check_and_copy(Elf32_Sword, dst, src, d_tag,      0);
+	check_and_copy(Elf32_Word,  dst, src, d_un.d_val, 0);
+    }
+    else {
+	seterr(ERROR_UNIMPLEMENTED);
+	return 0;
+    }
+    return 1;
+}
+
+GElf_Rela*
+gelf_getrela(Elf_Data *src, int ndx, GElf_Rela *dst) {
+    GElf_Rela buf;
+    unsigned cls;
+    char *tmp;
+
+    if (!dst) {
+	dst = &buf;
+    }
+    tmp = get_addr_and_class(src, ndx, ELF_T_RELA, &cls);
+    if (!tmp) {
+	return NULL;
+    }
+    if (cls == ELFCLASS64) {
+	*dst = *(Elf64_Rela*)tmp;
+    }
+    else if (cls == ELFCLASS32) {
+	Elf32_Rela *src = (Elf32_Rela*)tmp;
+
+	check_and_copy(GElf_Addr,   dst, src, r_offset, NULL);
+	dst->r_info = ELF64_R_INFO((Elf64_Xword)ELF32_R_SYM(src->r_info),
+				   (Elf64_Xword)ELF32_R_TYPE(src->r_info));
+	check_and_copy(GElf_Sxword, dst, src, r_addend, NULL);
+    }
+    else {
+	seterr(ERROR_UNIMPLEMENTED);
+	return NULL;
+    }
+    if (dst == &buf) {
+	dst = (GElf_Rela*)malloc(sizeof(GElf_Rela));
+	if (!dst) {
+	    seterr(ERROR_MEM_RELA);
+	    return NULL;
+	}
+	*dst = buf;
+    }
+    return dst;
+}
+
+int
+gelf_update_rela(Elf_Data *dst, int ndx, GElf_Rela *src) {
+    unsigned cls;
+    char *tmp;
+
+    tmp = get_addr_and_class(dst, ndx, ELF_T_RELA, &cls);
+    if (!tmp) {
+	return 0;
+    }
+    if (cls == ELFCLASS64) {
+	*(Elf64_Rela*)tmp = *src;
+    }
+    else if (cls == ELFCLASS32) {
+	Elf32_Rela *dst = (Elf32_Rela*)tmp;
+
+	check_and_copy(Elf32_Addr,  dst, src, r_offset, 0);
+	if (ELF64_R_SYM(src->r_info) > 0xffffffUL
+	 || ELF64_R_TYPE(src->r_info) > 0xffUL) {
+	    seterr(ERROR_BADVALUE);
+	    return 0;
+	}
+	dst->r_info = ELF32_R_INFO((Elf32_Word)ELF64_R_SYM(src->r_info),
+				  (Elf32_Word)ELF64_R_TYPE(src->r_info));
+	check_and_copy(Elf32_Sword, dst, src, r_addend, 0);
+    }
+    else {
+	seterr(ERROR_UNIMPLEMENTED);
+	return 0;
+    }
+    return 1;
+}
+
+GElf_Rel*
+gelf_getrel(Elf_Data *src, int ndx, GElf_Rel *dst) {
+    GElf_Rel buf;
+    unsigned cls;
+    char *tmp;
+
+    if (!dst) {
+	dst = &buf;
+    }
+    tmp = get_addr_and_class(src, ndx, ELF_T_REL, &cls);
+    if (!tmp) {
+	return NULL;
+    }
+    if (cls == ELFCLASS64) {
+	*dst = *(Elf64_Rel*)tmp;
+    }
+    else if (cls == ELFCLASS32) {
+	Elf32_Rel *src = (Elf32_Rel*)tmp;
+
+	check_and_copy(GElf_Addr, dst, src, r_offset, NULL);
+	dst->r_info = ELF64_R_INFO((Elf64_Xword)ELF32_R_SYM(src->r_info),
+				   (Elf64_Xword)ELF32_R_TYPE(src->r_info));
+    }
+    else {
+	seterr(ERROR_UNIMPLEMENTED);
+	return NULL;
+    }
+    if (dst == &buf) {
+	dst = (GElf_Rel*)malloc(sizeof(GElf_Rel));
+	if (!dst) {
+	    seterr(ERROR_MEM_REL);
+	    return NULL;
+	}
+	*dst = buf;
+    }
+    return dst;
+}
+
+int
+gelf_update_rel(Elf_Data *dst, int ndx, GElf_Rel *src) {
+    unsigned cls;
+    char *tmp;
+
+    tmp = get_addr_and_class(dst, ndx, ELF_T_REL, &cls);
+    if (!tmp) {
+	return 0;
+    }
+    if (cls == ELFCLASS64) {
+	*(Elf64_Rel*)tmp = *src;
+    }
+    else if (cls == ELFCLASS32) {
+	Elf32_Rel *dst = (Elf32_Rel*)tmp;
+
+	check_and_copy(Elf32_Addr, dst, src, r_offset, 0);
+	if (ELF64_R_SYM(src->r_info) > 0xffffffUL
+	 || ELF64_R_TYPE(src->r_info) > 0xffUL) {
+	    seterr(ERROR_BADVALUE);
+	    return 0;
+	}
+	dst->r_info = ELF32_R_INFO((Elf32_Word)ELF64_R_SYM(src->r_info),
+				   (Elf32_Word)ELF64_R_TYPE(src->r_info));
+    }
+    else {
+	seterr(ERROR_UNIMPLEMENTED);
+	return 0;
+    }
+    return 1;
+}
+
+#if 0
+
+GElf_Syminfo*
+gelf_getsyminfo(Elf_Data *src, int ndx, GElf_Syminfo *dst) {
+    seterr(ERROR_UNIMPLEMENTED);
+    return NULL;
+}
+
+int
+gelf_update_syminfo(Elf_Data *dst, int ndx, GElf_Syminfo *src) {
+    seterr(ERROR_UNIMPLEMENTED);
+    return 0;
+}
+
+GElf_Move*
+gelf_getmove(Elf_Data *src, int ndx, GElf_Move *src) {
+    seterr(ERROR_UNIMPLEMENTED);
+    return NULL;
+}
+
+int
+gelf_update_move(Elf_Data *dst, int ndx, GElf_Move *src) {
+    seterr(ERROR_UNIMPLEMENTED);
+    return 0;
+}
+
+#endif
+
+#endif /* __LIBELF64 */

+ 37 - 0
lib/libelf/lib/getarhdr.c

@@ -0,0 +1,37 @@
+/*
+getarhdr.c - implementation of the elf_getarhdr(3) function.
+Copyright (C) 1995 - 1998 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: getarhdr.c,v 1.7 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+Elf_Arhdr*
+elf_getarhdr(Elf *elf) {
+    if (!elf) {
+	return NULL;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    if (elf->e_arhdr) {
+	return elf->e_arhdr;
+    }
+    seterr(ERROR_NOTARCHIVE);
+    return NULL;
+}

+ 40 - 0
lib/libelf/lib/getaroff.c

@@ -0,0 +1,40 @@
+/*
+ * getaroff.c - implementation of the elf_getaroff(3) function.
+ * Copyright (C) 2009 Michael Riepe
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: getaroff.c,v 1.1 2009/11/01 13:04:19 michael Exp $";
+#endif /* lint */
+
+off_t
+elf_getaroff(Elf *elf) {
+    Elf *ref;
+
+    if (!elf) {
+	return (off_t)-1;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    if (!(ref = elf->e_parent)) {
+	return (off_t)-1;
+    }
+    elf_assert(ref->e_magic == ELF_MAGIC);
+    elf_assert(elf->e_base >= ref->e_base + SARMAG + sizeof(struct ar_hdr));
+    return (off_t)(elf->e_base - ref->e_base - sizeof(struct ar_hdr));
+}

+ 87 - 0
lib/libelf/lib/getarsym.c

@@ -0,0 +1,87 @@
+/*
+ * getarsym.c - implementation of the elf_getarsym(3) function.
+ * Copyright (C) 1995 - 1998, 2004 Michael Riepe
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <private.h>
+#include <byteswap.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: getarsym.c,v 1.9 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+Elf_Arsym*
+elf_getarsym(Elf *elf, size_t *ptr) {
+    Elf_Arsym *syms;
+    size_t count;
+    size_t tmp;
+    size_t i;
+    char *s;
+    char *e;
+
+    if (!ptr) {
+	ptr = &tmp;
+    }
+    *ptr = 0;
+    if (!elf) {
+	return NULL;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    if (elf->e_kind != ELF_K_AR) {
+	seterr(ERROR_NOTARCHIVE);
+	return NULL;
+    }
+    if (elf->e_symtab && !elf->e_free_syms) {
+	if (elf->e_symlen < 4) {
+	    seterr(ERROR_SIZE_ARSYMTAB);
+	    return NULL;
+	}
+	count = __load_u32M(elf->e_symtab);
+	if (elf->e_symlen < 4 * (count + 1)) {
+	    seterr(ERROR_SIZE_ARSYMTAB);
+	    return NULL;
+	}
+	if (!(syms = (Elf_Arsym*)malloc((count + 1) * sizeof(*syms)))) {
+	    seterr(ERROR_MEM_ARSYMTAB);
+	    return NULL;
+	}
+	s = elf->e_symtab + 4 * (count + 1);
+	e = elf->e_symtab + elf->e_symlen;
+	for (i = 0; i < count; i++, s++) {
+	    syms[i].as_name = s;
+	    while (s < e && *s) {
+		s++;
+	    }
+	    if (s >= e) {
+		seterr(ERROR_SIZE_ARSYMTAB);
+		free(syms);
+		return NULL;
+	    }
+	    elf_assert(!*s);
+	    syms[i].as_hash = elf_hash((unsigned char*)syms[i].as_name);
+	    syms[i].as_off = __load_u32M(elf->e_symtab + 4 * (i + 1));
+	}
+	syms[count].as_name = NULL;
+	syms[count].as_hash = ~0UL;
+	syms[count].as_off = 0;
+	elf->e_symtab = (char*)syms;
+	elf->e_symlen = count + 1;
+	elf->e_free_syms = 1;
+    }
+    *ptr = elf->e_symlen;
+    return (Elf_Arsym*)elf->e_symtab;
+}

+ 33 - 0
lib/libelf/lib/getbase.c

@@ -0,0 +1,33 @@
+/*
+getbase.c - implementation of the elf_getbase(3) function.
+Copyright (C) 1995 - 1998 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: getbase.c,v 1.7 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+off_t
+elf_getbase(Elf *elf) {
+    if (!elf) {
+	return -1;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    return (off_t)elf->e_base;
+}

+ 157 - 0
lib/libelf/lib/getdata.c

@@ -0,0 +1,157 @@
+/*
+getdata.c - implementation of the elf_getdata(3) function.
+Copyright (C) 1995 - 2001 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: getdata.c,v 1.13 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+static Elf_Data*
+_elf_cook_scn(Elf *elf, Elf_Scn *scn, Scn_Data *sd) {
+    Elf_Data dst;
+    Elf_Data src;
+    int flag = 0;
+    size_t dlen;
+
+    elf_assert(elf->e_data);
+
+    /*
+     * Prepare source
+     */
+    src = sd->sd_data;
+    src.d_version = elf->e_version;
+    if (elf->e_rawdata) {
+	src.d_buf = elf->e_rawdata + scn->s_offset;
+    }
+    else {
+	src.d_buf = elf->e_data + scn->s_offset;
+    }
+
+    /*
+     * Prepare destination (needs prepared source!)
+     */
+    dst = sd->sd_data;
+    if (elf->e_class == ELFCLASS32) {
+	dlen = _elf32_xltsize(&src, dst.d_version, elf->e_encoding, 0);
+    }
+#if __LIBELF64
+    else if (elf->e_class == ELFCLASS64) {
+	dlen = _elf64_xltsize(&src, dst.d_version, elf->e_encoding, 0);
+    }
+#endif /* __LIBELF64 */
+    else {
+	elf_assert(valid_class(elf->e_class));
+	seterr(ERROR_UNIMPLEMENTED);
+	return NULL;
+    }
+    if (dlen == (size_t)-1) {
+	return NULL;
+    }
+    dst.d_size = dlen;
+    if (elf->e_rawdata != elf->e_data && dst.d_size <= src.d_size) {
+	dst.d_buf = elf->e_data + scn->s_offset;
+    }
+    else if (!(dst.d_buf = malloc(dst.d_size))) {
+	seterr(ERROR_MEM_SCNDATA);
+	return NULL;
+    }
+    else {
+	flag = 1;
+    }
+
+    /*
+     * Translate data
+     */
+    if (_elf_xlatetom(elf, &dst, &src)) {
+	sd->sd_memdata = (char*)dst.d_buf;
+	sd->sd_data = dst;
+	if (!(sd->sd_free_data = flag)) {
+	    elf->e_cooked = 1;
+	}
+	return &sd->sd_data;
+    }
+
+    if (flag) {
+	free(dst.d_buf);
+    }
+    return NULL;
+}
+
+Elf_Data*
+elf_getdata(Elf_Scn *scn, Elf_Data *data) {
+    Scn_Data *sd;
+    Elf *elf;
+
+    if (!scn) {
+	return NULL;
+    }
+    elf_assert(scn->s_magic == SCN_MAGIC);
+    if (scn->s_index == SHN_UNDEF) {
+	seterr(ERROR_NULLSCN);
+    }
+    else if (data) {
+	for (sd = scn->s_data_1; sd; sd = sd->sd_link) {
+	    elf_assert(sd->sd_magic == DATA_MAGIC);
+	    elf_assert(sd->sd_scn == scn);
+	    if (data == &sd->sd_data) {
+		/*
+		 * sd_link allocated by elf_newdata().
+		 */
+		return &sd->sd_link->sd_data;
+	    }
+	}
+	seterr(ERROR_SCNDATAMISMATCH);
+    }
+    else if ((sd = scn->s_data_1)) {
+	elf_assert(sd->sd_magic == DATA_MAGIC);
+	elf_assert(sd->sd_scn == scn);
+	elf = scn->s_elf;
+	elf_assert(elf);
+	elf_assert(elf->e_magic == ELF_MAGIC);
+	if (sd->sd_freeme) {
+	    /* allocated by elf_newdata() */
+	    return &sd->sd_data;
+	}
+	else if (scn->s_type == SHT_NULL) {
+	    seterr(ERROR_NULLSCN);
+	}
+	else if (sd->sd_memdata) {
+	    /* already cooked */
+	    return &sd->sd_data;
+	}
+	else if (scn->s_offset < 0 || scn->s_offset > elf->e_size) {
+	    seterr(ERROR_OUTSIDE);
+	}
+	else if (scn->s_type == SHT_NOBITS || !scn->s_size) {
+	    /* no data to read */
+	    return &sd->sd_data;
+	}
+	else if (scn->s_offset + scn->s_size > elf->e_size) {
+	    seterr(ERROR_TRUNC_SCN);
+	}
+	else if (valid_class(elf->e_class)) {
+	    return _elf_cook_scn(elf, scn, sd);
+	}
+	else {
+	    seterr(ERROR_UNKNOWN_CLASS);
+	}
+    }
+    return NULL;
+}

+ 48 - 0
lib/libelf/lib/getident.c

@@ -0,0 +1,48 @@
+/*
+getident.c - implementation of the elf_getident(3) function.
+Copyright (C) 1995 - 1998 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: getident.c,v 1.7 2008/05/23 08:15:34 michael Exp $";
+#endif /* lint */
+
+char*
+elf_getident(Elf *elf, size_t *ptr) {
+    size_t tmp;
+
+    if (!ptr) {
+	ptr = &tmp;
+    }
+    if (!elf) {
+	*ptr = 0;
+	return NULL;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    if (elf->e_kind != ELF_K_ELF) {
+	*ptr = elf->e_idlen;
+	return elf->e_data;
+    }
+    if (elf->e_ehdr || _elf_cook(elf)) {
+	*ptr = elf->e_idlen;
+	return elf->e_ehdr;
+    }
+    *ptr = 0;
+    return NULL;
+}

+ 48 - 0
lib/libelf/lib/getscn.c

@@ -0,0 +1,48 @@
+/*
+getscn.c - implementation of the elf_getscn(3) function.
+Copyright (C) 1995 - 1998 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: getscn.c,v 1.7 2008/05/23 08:15:35 michael Exp $";
+#endif /* lint */
+
+Elf_Scn*
+elf_getscn(Elf *elf, size_t index) {
+    Elf_Scn *scn;
+
+    if (!elf) {
+	return NULL;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    if (elf->e_kind != ELF_K_ELF) {
+	seterr(ERROR_NOTELF);
+    }
+    else if (elf->e_ehdr || _elf_cook(elf)) {
+	for (scn = elf->e_scn_1; scn; scn = scn->s_link) {
+	    elf_assert(scn->s_magic == SCN_MAGIC);
+	    elf_assert(scn->s_elf == elf);
+	    if (scn->s_index == index) {
+		return scn;
+	    }
+	}
+	seterr(ERROR_NOSUCHSCN);
+    }
+    return NULL;
+}

+ 38 - 0
lib/libelf/lib/hash.c

@@ -0,0 +1,38 @@
+/*
+hash.c - implementation of the elf_hash(3) function.
+Copyright (C) 1995 - 2002 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: hash.c,v 1.10 2008/05/23 08:15:35 michael Exp $";
+#endif /* lint */
+
+unsigned long
+elf_hash(const unsigned char *name) {
+    unsigned long hash = 0;
+    unsigned long tmp;
+
+    while (*name) {
+	hash = (hash << 4) + (unsigned char)*name++;
+	if ((tmp = hash & 0xf0000000)) {
+	    hash ^= tmp | (tmp >> 24);
+	}
+    }
+    return hash;
+}

+ 106 - 0
lib/libelf/lib/input.c

@@ -0,0 +1,106 @@
+/*
+ * input.c - low-level input for libelf.
+ * Copyright (C) 1995 - 2001, 2005 Michael Riepe
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: input.c,v 1.11 2008/05/23 08:15:35 michael Exp $";
+#endif /* lint */
+
+#include <errno.h>
+
+#if HAVE_MMAP
+#include <sys/mman.h>
+#endif /* HAVE_MMAP */
+
+static int
+xread(int fd, char *buffer, size_t len) {
+    size_t done = 0;
+    size_t n;
+
+    while (done < len) {
+	n = read(fd, buffer + done, len - done);
+	if (n == 0) {
+	    /* premature end of file */
+	    return -1;
+	}
+	else if (n != (size_t)-1) {
+	    /* some bytes read, continue */
+	    done += n;
+	}
+	else if (errno != EAGAIN && errno != EINTR) {
+	    /* real error */
+	    return -1;
+	}
+    }
+    return 0;
+}
+
+void*
+_elf_read(Elf *elf, void *buffer, size_t off, size_t len) {
+    void *tmp;
+
+    elf_assert(elf);
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    elf_assert(off >= 0 && off + len <= elf->e_size);
+    if (elf->e_disabled) {
+	seterr(ERROR_FDDISABLED);
+    }
+    else if (len) {
+	off += elf->e_base;
+	if (lseek(elf->e_fd, (off_t)off, SEEK_SET) != (off_t)off) {
+	    seterr(ERROR_IO_SEEK);
+	}
+	else if (!(tmp = buffer) && !(tmp = malloc(len))) {
+	    seterr(ERROR_IO_2BIG);
+	}
+	else if (xread(elf->e_fd, tmp, len)) {
+	    seterr(ERROR_IO_READ);
+	    if (tmp != buffer) {
+		free(tmp);
+	    }
+	}
+	else {
+	    return tmp;
+	}
+    }
+    return NULL;
+}
+
+void*
+_elf_mmap(Elf *elf) {
+#if HAVE_MMAP
+    void *tmp;
+
+    elf_assert(elf);
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    elf_assert(elf->e_base == 0);
+    if (elf->e_disabled) {
+	seterr(ERROR_FDDISABLED);
+    }
+    else if (elf->e_size) {
+	tmp = (void*)mmap(0, elf->e_size, PROT_READ | PROT_WRITE,
+			  MAP_PRIVATE, elf->e_fd, 0);
+	if (tmp != (void*)-1) {
+	    return tmp;
+	}
+    }
+#endif /* HAVE_MMAP */
+    return NULL;
+}

+ 33 - 0
lib/libelf/lib/kind.c

@@ -0,0 +1,33 @@
+/*
+kind.c - implementation of the elf_kind(3) function.
+Copyright (C) 1995 - 1998 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: kind.c,v 1.7 2008/05/23 08:15:35 michael Exp $";
+#endif /* lint */
+
+Elf_Kind
+elf_kind(Elf *elf) {
+    if (!elf) {
+	return ELF_K_NONE;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    return elf->e_kind;
+}

+ 82 - 0
lib/libelf/lib/libelf.def

@@ -0,0 +1,82 @@
+LIBRARY libelf
+VERSION 0.8
+EXPORTS
+	elf_begin
+	elf_cntl
+	elf_delscn
+	elf_end
+	elf_errmsg
+	elf_errno
+	elf_fill
+	elf_flagdata
+	elf_flagehdr
+	elf_flagelf
+	elf_flagphdr
+	elf_flagscn
+	elf_flagshdr
+	elf_getarhdr
+	elf_getarsym
+	elf_getbase
+	elf_getdata
+	elf_getident
+	elf_getscn
+	elf_hash
+	elf_kind
+	elf_memory
+	elf_ndxscn
+	elf_newdata
+	elf_newscn
+	elf_next
+	elf_nextscn
+	elf_rand
+	elf_rawdata
+	elf_rawfile
+	elf_strptr
+	elf_update
+	elf_version
+	elf32_checksum
+	elf32_fsize
+	elf32_getehdr
+	elf32_getphdr
+	elf32_getshdr
+	elf32_newehdr
+	elf32_newphdr
+	elf32_xlatetof
+	elf32_xlatetom
+	elf64_checksum
+	elf64_fsize
+	elf64_getehdr
+	elf64_getphdr
+	elf64_getshdr
+	elf64_newehdr
+	elf64_newphdr
+	elf64_xlatetof
+	elf64_xlatetom
+	elfx_movscn
+	elfx_remscn
+	gelf_checksum
+	gelf_fsize
+	gelf_getclass
+	gelf_getdyn
+	gelf_getehdr
+	gelf_getphdr
+	gelf_getrel
+	gelf_getrela
+	gelf_getshdr
+	gelf_getsym
+	gelf_msize
+	gelf_newehdr
+	gelf_newphdr
+	gelf_update_dyn
+	gelf_update_ehdr
+	gelf_update_phdr
+	gelf_update_rel
+	gelf_update_rela
+	gelf_update_shdr
+	gelf_update_sym
+	gelf_xlatetof
+	gelf_xlatetom
+	elf_getphnum
+	elf_getshnum
+	elf_getshstrndx
+	elfx_update_shstrndx

+ 305 - 0
lib/libelf/lib/libelf.h

@@ -0,0 +1,305 @@
+/*
+ * libelf.h - public header file for libelf.
+ * Copyright (C) 1995 - 2008 Michael Riepe
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+/* @(#) $Id: libelf.h,v 1.29 2009/07/07 17:57:43 michael Exp $ */
+
+#ifndef _LIBELF_H
+#define _LIBELF_H
+
+#include <stddef.h>	/* for size_t */
+#include <sys/types.h>
+
+#if __LIBELF_INTERNAL__
+#include <sys_elf.h>
+#else /* __LIBELF_INTERNAL__ */
+#include <libelf/sys_elf.h>
+#endif /* __LIBELF_INTERNAL__ */
+
+#if defined __GNUC__ && !defined __cplusplus
+#define DEPRECATED	__attribute__((deprecated))
+#else
+#define DEPRECATED	/* nothing */
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifndef __P
+# if (__STDC__ + 0) || defined(__cplusplus) || defined(_WIN32)
+#  define __P(args) args
+# else /* __STDC__ || defined(__cplusplus) */
+#  define __P(args) ()
+# endif /* __STDC__ || defined(__cplusplus) */
+#endif /* __P */
+
+/*
+ * Commands
+ */
+typedef enum {
+    ELF_C_NULL = 0,	/* must be first, 0 */
+    ELF_C_READ,
+    ELF_C_WRITE,
+    ELF_C_CLR,
+    ELF_C_SET,
+    ELF_C_FDDONE,
+    ELF_C_FDREAD,
+    ELF_C_RDWR,
+    ELF_C_NUM		/* must be last */
+} Elf_Cmd;
+
+/*
+ * Flags
+ */
+#define ELF_F_DIRTY	0x1
+#define ELF_F_LAYOUT	0x4
+/*
+ * Allow sections to overlap when ELF_F_LAYOUT is in effect.
+ * Note that this flag ist NOT portable, and that it may render
+ * the output file unusable.  Use with extreme caution!
+ */
+#define ELF_F_LAYOUT_OVERLAP	0x10000000
+
+/*
+ * File types
+ */
+typedef enum {
+    ELF_K_NONE = 0,	/* must be first, 0 */
+    ELF_K_AR,
+    ELF_K_COFF,
+    ELF_K_ELF,
+    ELF_K_NUM		/* must be last */
+} Elf_Kind;
+
+/*
+ * Data types
+ */
+typedef enum {
+    ELF_T_BYTE = 0,	/* must be first, 0 */
+    ELF_T_ADDR,
+    ELF_T_DYN,
+    ELF_T_EHDR,
+    ELF_T_HALF,
+    ELF_T_OFF,
+    ELF_T_PHDR,
+    ELF_T_RELA,
+    ELF_T_REL,
+    ELF_T_SHDR,
+    ELF_T_SWORD,
+    ELF_T_SYM,
+    ELF_T_WORD,
+    /*
+     * New stuff for 64-bit.
+     *
+     * Most implementations add ELF_T_SXWORD after ELF_T_SWORD
+     * which breaks binary compatibility with earlier versions.
+     * If this causes problems for you, contact me.
+     */
+    ELF_T_SXWORD,
+    ELF_T_XWORD,
+    /*
+     * Symbol versioning.  Sun broke binary compatibility (again!),
+     * but I won't.
+     */
+    ELF_T_VDEF,
+    ELF_T_VNEED,
+    ELF_T_NUM		/* must be last */
+} Elf_Type;
+
+/*
+ * Elf descriptor
+ */
+typedef struct Elf	Elf;
+
+/*
+ * Section descriptor
+ */
+typedef struct Elf_Scn	Elf_Scn;
+
+/*
+ * Archive member header
+ */
+typedef struct {
+    char*		ar_name;
+    time_t		ar_date;
+    long		ar_uid;
+    long 		ar_gid;
+    unsigned long	ar_mode;
+    off_t		ar_size;
+    char*		ar_rawname;
+} Elf_Arhdr;
+
+/*
+ * Archive symbol table
+ */
+typedef struct {
+    char*		as_name;
+    size_t		as_off;
+    unsigned long	as_hash;
+} Elf_Arsym;
+
+/*
+ * Data descriptor
+ */
+typedef struct {
+    void*		d_buf;
+    Elf_Type		d_type;
+    size_t		d_size;
+    off_t		d_off;
+    size_t		d_align;
+    unsigned		d_version;
+} Elf_Data;
+
+/*
+ * Function declarations
+ */
+extern Elf *elf_begin __P((int __fd, Elf_Cmd __cmd, Elf *__ref));
+extern Elf *elf_memory __P((char *__image, size_t __size));
+extern int elf_cntl __P((Elf *__elf, Elf_Cmd __cmd));
+extern int elf_end __P((Elf *__elf));
+extern const char *elf_errmsg __P((int __err));
+extern int elf_errno __P((void));
+extern void elf_fill __P((int __fill));
+extern unsigned elf_flagdata __P((Elf_Data *__data, Elf_Cmd __cmd,
+	unsigned __flags));
+extern unsigned elf_flagehdr __P((Elf *__elf, Elf_Cmd __cmd,
+	unsigned __flags));
+extern unsigned elf_flagelf __P((Elf *__elf, Elf_Cmd __cmd,
+	unsigned __flags));
+extern unsigned elf_flagphdr __P((Elf *__elf, Elf_Cmd __cmd,
+	unsigned __flags));
+extern unsigned elf_flagscn __P((Elf_Scn *__scn, Elf_Cmd __cmd,
+	unsigned __flags));
+extern unsigned elf_flagshdr __P((Elf_Scn *__scn, Elf_Cmd __cmd,
+	unsigned __flags));
+extern size_t elf32_fsize __P((Elf_Type __type, size_t __count,
+	unsigned __ver));
+extern Elf_Arhdr *elf_getarhdr __P((Elf *__elf));
+extern Elf_Arsym *elf_getarsym __P((Elf *__elf, size_t *__ptr));
+extern off_t elf_getbase __P((Elf *__elf));
+extern Elf_Data *elf_getdata __P((Elf_Scn *__scn, Elf_Data *__data));
+extern Elf32_Ehdr *elf32_getehdr __P((Elf *__elf));
+extern char *elf_getident __P((Elf *__elf, size_t *__ptr));
+extern Elf32_Phdr *elf32_getphdr __P((Elf *__elf));
+extern Elf_Scn *elf_getscn __P((Elf *__elf, size_t __index));
+extern Elf32_Shdr *elf32_getshdr __P((Elf_Scn *__scn));
+extern unsigned long elf_hash __P((const unsigned char *__name));
+extern Elf_Kind elf_kind __P((Elf *__elf));
+extern size_t elf_ndxscn __P((Elf_Scn *__scn));
+extern Elf_Data *elf_newdata __P((Elf_Scn *__scn));
+extern Elf32_Ehdr *elf32_newehdr __P((Elf *__elf));
+extern Elf32_Phdr *elf32_newphdr __P((Elf *__elf, size_t __count));
+extern Elf_Scn *elf_newscn __P((Elf *__elf));
+extern Elf_Cmd elf_next __P((Elf *__elf));
+extern Elf_Scn *elf_nextscn __P((Elf *__elf, Elf_Scn *__scn));
+extern size_t elf_rand __P((Elf *__elf, size_t __offset));
+extern Elf_Data *elf_rawdata __P((Elf_Scn *__scn, Elf_Data *__data));
+extern char *elf_rawfile __P((Elf *__elf, size_t *__ptr));
+extern char *elf_strptr __P((Elf *__elf, size_t __section, size_t __offset));
+extern off_t elf_update __P((Elf *__elf, Elf_Cmd __cmd));
+extern unsigned elf_version __P((unsigned __ver));
+extern Elf_Data *elf32_xlatetof __P((Elf_Data *__dst, const Elf_Data *__src,
+	unsigned __encode));
+extern Elf_Data *elf32_xlatetom __P((Elf_Data *__dst, const Elf_Data *__src,
+	unsigned __encode));
+
+/*
+ * Additional functions found on Solaris
+ */
+extern long elf32_checksum __P((Elf *__elf));
+
+#if __LIBELF64
+/*
+ * 64-bit ELF functions
+ * Not available on all platforms
+ */
+extern Elf64_Ehdr *elf64_getehdr __P((Elf *__elf));
+extern Elf64_Ehdr *elf64_newehdr __P((Elf *__elf));
+extern Elf64_Phdr *elf64_getphdr __P((Elf *__elf));
+extern Elf64_Phdr *elf64_newphdr __P((Elf *__elf, size_t __count));
+extern Elf64_Shdr *elf64_getshdr __P((Elf_Scn *__scn));
+extern size_t elf64_fsize __P((Elf_Type __type, size_t __count,
+	unsigned __ver));
+extern Elf_Data *elf64_xlatetof __P((Elf_Data *__dst, const Elf_Data *__src,
+	unsigned __encode));
+extern Elf_Data *elf64_xlatetom __P((Elf_Data *__dst, const Elf_Data *__src,
+	unsigned __encode));
+
+/*
+ * Additional functions found on Solaris
+ */
+extern long elf64_checksum __P((Elf *__elf));
+
+#endif /* __LIBELF64 */
+
+/*
+ * ELF format extensions
+ *
+ * These functions return 0 on failure, 1 on success.  Since other
+ * implementations of libelf may behave differently (there was quite
+ * some confusion about the correct values), they are now officially
+ * deprecated and should be replaced with the three new functions below.
+ */
+DEPRECATED extern int elf_getphnum __P((Elf *__elf, size_t *__resultp));
+DEPRECATED extern int elf_getshnum __P((Elf *__elf, size_t *__resultp));
+DEPRECATED extern int elf_getshstrndx __P((Elf *__elf, size_t *__resultp));
+/*
+ * Replacement functions (return -1 on failure, 0 on success).
+ */
+extern int elf_getphdrnum __P((Elf *__elf, size_t *__resultp));
+extern int elf_getshdrnum __P((Elf *__elf, size_t *__resultp));
+extern int elf_getshdrstrndx __P((Elf *__elf, size_t *__resultp));
+
+/*
+ * Convenience functions
+ *
+ * elfx_update_shstrndx is elf_getshstrndx's counterpart.
+ * It should be used to set the e_shstrndx member.
+ * There is no update function for e_shnum or e_phnum
+ * because libelf handles them internally.
+ */
+extern int elfx_update_shstrndx __P((Elf *__elf, size_t __index));
+
+/*
+ * Experimental extensions:
+ *
+ * elfx_movscn() moves section `__scn' directly after section `__after'.
+ * elfx_remscn() removes section `__scn'.  Both functions update
+ * the section indices; elfx_remscn() also adjusts the ELF header's
+ * e_shnum member.  The application is responsible for updating other
+ * data (in particular, e_shstrndx and the section headers' sh_link and
+ * sh_info members).
+ *
+ * elfx_movscn() returns the new index of the moved section.
+ * elfx_remscn() returns the original index of the removed section.
+ * A return value of zero indicates an error.
+ */
+extern size_t elfx_movscn __P((Elf *__elf, Elf_Scn *__scn, Elf_Scn *__after));
+extern size_t elfx_remscn __P((Elf *__elf, Elf_Scn *__scn));
+
+/*
+ * elf_delscn() is obsolete.  Please use elfx_remscn() instead.
+ */
+extern size_t elf_delscn __P((Elf *__elf, Elf_Scn *__scn));
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _LIBELF_H */

+ 1 - 0
lib/libelf/lib/libelf/byteswap.h

@@ -0,0 +1 @@
+../byteswap.h

+ 1 - 0
lib/libelf/lib/libelf/elf_repl.h

@@ -0,0 +1 @@
+../elf_repl.h

+ 1 - 0
lib/libelf/lib/libelf/errors.h

@@ -0,0 +1 @@
+../errors.h

+ 1 - 0
lib/libelf/lib/libelf/ext_types.h

@@ -0,0 +1 @@
+../ext_types.h

+ 1 - 0
lib/libelf/lib/libelf/gelf.h

@@ -0,0 +1 @@
+../gelf.h

+ 1 - 0
lib/libelf/lib/libelf/libelf.h

@@ -0,0 +1 @@
+../libelf.h

+ 1 - 0
lib/libelf/lib/libelf/nlist.h

@@ -0,0 +1 @@
+../nlist.h

+ 1 - 0
lib/libelf/lib/libelf/private.h

@@ -0,0 +1 @@
+../private.h

+ 1 - 0
lib/libelf/lib/libelf/sys_elf.h

@@ -0,0 +1 @@
+../sys_elf.h

+ 1 - 0
lib/libelf/lib/libelf/verdef.h

@@ -0,0 +1 @@
+../verdef.h

+ 1 - 0
lib/libelf/lib/libelf/verneed.h

@@ -0,0 +1 @@
+../verneed.h

+ 53 - 0
lib/libelf/lib/memset.c

@@ -0,0 +1,53 @@
+/*
+ * memset.c - replacement for memset(3), using duff's device.
+ * Copyright (C) 1995 - 2004 Michael Riepe
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: memset.c,v 1.11 2008/05/23 08:15:35 michael Exp $";
+#endif /* lint */
+
+#include <stddef.h>	/* for size_t */
+#include <sys/types.h>
+
+void*
+_elf_memset(void *s, int c, size_t n) {
+    char *t = (char*)s;
+
+    if (n) {
+	switch (n % 8u) {
+	    do {
+		n -= 8;
+		default:
+		case 0: *t++ = (char)c;
+		case 7: *t++ = (char)c;
+		case 6: *t++ = (char)c;
+		case 5: *t++ = (char)c;
+		case 4: *t++ = (char)c;
+		case 3: *t++ = (char)c;
+		case 2: *t++ = (char)c;
+		case 1: *t++ = (char)c;
+	    }
+	    while (n > 8);
+	}
+    }
+    return s;
+}

+ 33 - 0
lib/libelf/lib/ndxscn.c

@@ -0,0 +1,33 @@
+/*
+ndxscn.c - implementation of the elf_ndxscn(3) function.
+Copyright (C) 1995 - 1998 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: ndxscn.c,v 1.7 2008/05/23 08:15:35 michael Exp $";
+#endif /* lint */
+
+size_t
+elf_ndxscn(Elf_Scn *scn) {
+    if (!scn) {
+	return SHN_UNDEF;
+    }
+    elf_assert(scn->s_magic == SCN_MAGIC);
+    return scn->s_index;
+}

+ 56 - 0
lib/libelf/lib/newdata.c

@@ -0,0 +1,56 @@
+/*
+newdata.c - implementation of the elf_newdata(3) function.
+Copyright (C) 1995 - 2000 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: newdata.c,v 1.10 2008/05/23 08:15:35 michael Exp $";
+#endif /* lint */
+
+Elf_Data*
+elf_newdata(Elf_Scn *scn) {
+    Scn_Data *sd;
+
+    if (!scn) {
+	return NULL;
+    }
+    elf_assert(scn->s_magic == SCN_MAGIC);
+    if (scn->s_index == SHN_UNDEF) {
+	seterr(ERROR_NULLSCN);
+    }
+    else if (!(sd = (Scn_Data*)malloc(sizeof(*sd)))) {
+	seterr(ERROR_MEM_SCNDATA);
+    }
+    else {
+	*sd = _elf_data_init;
+	sd->sd_scn = scn;
+	sd->sd_data_flags = ELF_F_DIRTY;
+	sd->sd_freeme = 1;
+	sd->sd_data.d_version = _elf_version;
+	if (scn->s_data_n) {
+	    scn->s_data_n->sd_link = sd;
+	}
+	else {
+	    scn->s_data_1 = sd;
+	}
+	scn->s_data_n = sd;
+	return &sd->sd_data;
+    }
+    return NULL;
+}

+ 145 - 0
lib/libelf/lib/newscn.c

@@ -0,0 +1,145 @@
+/*
+ * newscn.c - implementation of the elf_newscn(3) function.
+ * Copyright (C) 1995 - 2006 Michael Riepe
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: newscn.c,v 1.13 2008/05/23 08:15:35 michael Exp $";
+#endif /* lint */
+
+int
+_elf_update_shnum(Elf *elf, size_t shnum) {
+    size_t extshnum = 0;
+    Elf_Scn *scn;
+
+    elf_assert(elf);
+    elf_assert(elf->e_ehdr);
+    scn = elf->e_scn_1;
+    elf_assert(scn);
+    elf_assert(scn->s_index == 0);
+    if (shnum >= SHN_LORESERVE) {
+	extshnum = shnum;
+	shnum = 0;
+    }
+    if (elf->e_class == ELFCLASS32) {
+	((Elf32_Ehdr*)elf->e_ehdr)->e_shnum = shnum;
+	scn->s_shdr32.sh_size = extshnum;
+    }
+#if __LIBELF64
+    else if (elf->e_class == ELFCLASS64) {
+	((Elf64_Ehdr*)elf->e_ehdr)->e_shnum = shnum;
+	scn->s_shdr64.sh_size = extshnum;
+    }
+#endif /* __LIBELF64 */
+    else {
+	if (valid_class(elf->e_class)) {
+	    seterr(ERROR_UNIMPLEMENTED);
+	}
+	else {
+	    seterr(ERROR_UNKNOWN_CLASS);
+	}
+	return -1;
+    }
+    elf->e_ehdr_flags |= ELF_F_DIRTY;
+    scn->s_shdr_flags |= ELF_F_DIRTY;
+    return 0;
+}
+
+static Elf_Scn*
+_makescn(Elf *elf, size_t index) {
+    Elf_Scn *scn;
+
+    elf_assert(elf);
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    elf_assert(elf->e_ehdr);
+    elf_assert(_elf_scn_init.s_magic == SCN_MAGIC);
+    if (!(scn = (Elf_Scn*)malloc(sizeof(*scn)))) {
+	seterr(ERROR_MEM_SCN);
+	return NULL;
+    }
+    *scn = _elf_scn_init;
+    scn->s_elf = elf;
+    scn->s_scn_flags = ELF_F_DIRTY;
+    scn->s_shdr_flags = ELF_F_DIRTY;
+    scn->s_freeme = 1;
+    scn->s_index = index;
+    return scn;
+}
+
+Elf_Scn*
+_elf_first_scn(Elf *elf) {
+    Elf_Scn *scn;
+
+    elf_assert(elf);
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    if ((scn = elf->e_scn_1)) {
+	return scn;
+    }
+    if ((scn = _makescn(elf, 0))) {
+	elf->e_scn_1 = elf->e_scn_n = scn;
+	if (_elf_update_shnum(elf, 1)) {
+	    free(scn);
+	    elf->e_scn_1 = elf->e_scn_n = scn = NULL;
+	}
+    }
+    return scn;
+}
+
+static Elf_Scn*
+_buildscn(Elf *elf) {
+    Elf_Scn *scn;
+
+    if (!_elf_first_scn(elf)) {
+	return NULL;
+    }
+    scn = elf->e_scn_n;
+    elf_assert(scn);
+    if (!(scn = _makescn(elf, scn->s_index + 1))) {
+	return NULL;
+    }
+    if (_elf_update_shnum(elf, scn->s_index + 1)) {
+	free(scn);
+	return NULL;
+    }
+    elf->e_scn_n = elf->e_scn_n->s_link = scn;
+    return scn;
+}
+
+Elf_Scn*
+elf_newscn(Elf *elf) {
+    Elf_Scn *scn;
+
+    if (!elf) {
+	return NULL;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    if (!elf->e_readable && !elf->e_ehdr) {
+	seterr(ERROR_NOEHDR);
+    }
+    else if (elf->e_kind != ELF_K_ELF) {
+	seterr(ERROR_NOTELF);
+    }
+    else if (!elf->e_ehdr && !_elf_cook(elf)) {
+	return NULL;
+    }
+    else if ((scn = _buildscn(elf))) {
+	return scn;
+    }
+    return NULL;
+}

+ 42 - 0
lib/libelf/lib/next.c

@@ -0,0 +1,42 @@
+/*
+next.c - implementation of the elf_next(3) function.
+Copyright (C) 1995 - 1998 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: next.c,v 1.7 2008/05/23 08:15:35 michael Exp $";
+#endif /* lint */
+
+Elf_Cmd
+elf_next(Elf *elf) {
+    if (!elf) {
+	return ELF_C_NULL;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    if (!elf->e_parent) {
+	return ELF_C_NULL;
+    }
+    elf_assert(elf->e_parent->e_magic == ELF_MAGIC);
+    elf_assert(elf->e_parent->e_kind == ELF_K_AR);
+    elf->e_parent->e_off = elf->e_next;
+    if (elf->e_next == elf->e_parent->e_size) {
+	return ELF_C_NULL;
+    }
+    return ELF_C_READ;
+}

+ 54 - 0
lib/libelf/lib/nextscn.c

@@ -0,0 +1,54 @@
+/*
+nextscn.c - implementation of the elf_nextscn(3) function.
+Copyright (C) 1995 - 1998 Michael Riepe
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <private.h>
+
+#ifndef lint
+static const char rcsid[] = "@(#) $Id: nextscn.c,v 1.7 2008/05/23 08:15:35 michael Exp $";
+#endif /* lint */
+
+Elf_Scn*
+elf_nextscn(Elf *elf, Elf_Scn *scn) {
+    if (!elf) {
+	return NULL;
+    }
+    elf_assert(elf->e_magic == ELF_MAGIC);
+    if (scn) {
+	elf_assert(scn->s_magic == SCN_MAGIC);
+	if (scn->s_elf == elf) {
+	    return scn->s_link;
+	}
+	seterr(ERROR_ELFSCNMISMATCH);
+    }
+    else if (elf->e_kind != ELF_K_ELF) {
+	seterr(ERROR_NOTELF);
+    }
+    else if (elf->e_ehdr || _elf_cook(elf)) {
+	elf_assert(elf->e_ehdr);
+	for (scn = elf->e_scn_1; scn; scn = scn->s_link) {
+	    elf_assert(scn->s_magic == SCN_MAGIC);
+	    elf_assert(scn->s_elf == elf);
+	    if (scn->s_index == 1) {
+		return scn;
+	    }
+	}
+	seterr(ERROR_NOSUCHSCN);
+    }
+    return NULL;
+}

Някои файлове не бяха показани, защото твърде много файлове са промени