lib: Provide MAX and MIN in system.h

This change also creates a new header file libeu.h to provide the
prototypes for the function of libeu. That hides the definition of function
crc32, which can conflict with zlib, from libelf. It also prevents mistakes
to refer those functions from a component which doesn't link with libeu,
such as libelf.

Signed-off-by: Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 76b5753..88c71c9 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,17 @@
+2015-10-11  Akihiko Odaki  <akihiko.odaki.4i@stu.hosei.ac.jp>
+
+	* Makefile.am (noinst_HEADERS): Add libeu.h.
+	* color.c: Remove system.h include, add libeu.h include.
+	* crc32_file.c: Likewise.
+	* fixedsizehash.h: Remove sys/param.h include.
+	* libeu.h: New file.
+	* system.h: Include sys/param.h.
+	(xmalloc, xcalloc, xrealloc, xstrdup, xstrndup, crc32, crc32_file,
+	color_argp, color_enum, color_*): Move definitions to libeu.h.
+	* xstrdup.c: Remove system.h include, add libeu.h include.
+	* xstrndup.c: Remove system.h include, add libeu.h and stdint.h
+	includes.
+
 2015-09-24  Jose E. Marchesi  <jose.marchesi@oracle.com>
 
 	* Makefile.am (AM_CFLAGS): Use -fPIC instead of -fpic to avoid relocation
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 2219eaa..7ca2bd4 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -37,8 +37,8 @@
 		  crc32.c crc32_file.c md5.c sha1.c \
 		  color.c
 
-noinst_HEADERS = fixedsizehash.h system.h dynamicsizehash.h list.h md5.h \
-		 sha1.h eu-config.h
+noinst_HEADERS = fixedsizehash.h libeu.h system.h dynamicsizehash.h list.h \
+		 md5.h sha1.h eu-config.h
 EXTRA_DIST = dynamicsizehash.c
 
 if !GPROF
diff --git a/lib/color.c b/lib/color.c
index d1309ed..fde2d9d 100644
--- a/lib/color.c
+++ b/lib/color.c
@@ -37,7 +37,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include "system.h"
+#include "libeu.h"
 
 
 /* Prototype for option handler.  */
diff --git a/lib/crc32_file.c b/lib/crc32_file.c
index c0b18e9..a8434d4 100644
--- a/lib/crc32_file.c
+++ b/lib/crc32_file.c
@@ -30,7 +30,7 @@
 # include <config.h>
 #endif
 
-#include "system.h"
+#include "libeu.h"
 #include <errno.h>
 #include <unistd.h>
 #include <sys/stat.h>
diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h
index 06ce6a2..18921a4 100644
--- a/lib/fixedsizehash.h
+++ b/lib/fixedsizehash.h
@@ -31,7 +31,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/cdefs.h>
-#include <sys/param.h>
 
 #include <system.h>
 
diff --git a/lib/libeu.h b/lib/libeu.h
new file mode 100644
index 0000000..69fe3d7
--- /dev/null
+++ b/lib/libeu.h
@@ -0,0 +1,78 @@
+/* Declarations for the common library.
+   Copyright (C) 2006-2011 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * 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
+
+   or both in parallel, as here.
+
+   elfutils 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 copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef LIBEU_H
+#define LIBEU_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+extern void *xmalloc (size_t) __attribute__ ((__malloc__));
+extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__));
+extern void *xrealloc (void *, size_t) __attribute__ ((__malloc__));
+
+extern char *xstrdup (const char *) __attribute__ ((__malloc__));
+extern char *xstrndup (const char *, size_t) __attribute__ ((__malloc__));
+
+
+extern uint32_t crc32 (uint32_t crc, unsigned char *buf, size_t len);
+extern int crc32_file (int fd, uint32_t *resp);
+
+
+/* Color handling.  */
+
+/* Command line parser.  */
+extern const struct argp color_argp;
+
+/* Coloring mode.  */
+enum color_enum
+  {
+    color_never = 0,
+    color_always,
+    color_auto
+  } __attribute__ ((packed));
+extern enum color_enum color_mode;
+
+/* Colors to use for the various components.  */
+extern char *color_address;
+extern char *color_bytes;
+extern char *color_mnemonic;
+extern char *color_operand1;
+extern char *color_operand2;
+extern char *color_operand3;
+extern char *color_label;
+extern char *color_undef;
+extern char *color_undef_tls;
+extern char *color_undef_weak;
+extern char *color_symbol;
+extern char *color_tls;
+extern char *color_weak;
+
+extern const char color_off[];
+
+#endif
diff --git a/lib/system.h b/lib/system.h
index f31cfd0..ec387c3 100644
--- a/lib/system.h
+++ b/lib/system.h
@@ -32,6 +32,7 @@
 #include <argp.h>
 #include <stddef.h>
 #include <stdint.h>
+#include <sys/param.h>
 #include <endian.h>
 #include <byteswap.h>
 #include <unistd.h>
@@ -50,17 +51,15 @@
 # error "Unknown byte order"
 #endif
 
-extern void *xmalloc (size_t) __attribute__ ((__malloc__));
-extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__));
-extern void *xrealloc (void *, size_t) __attribute__ ((__malloc__));
+#ifndef MAX
+#define MAX(m, n) ((m) < (n) ? (n) : (m))
+#endif
 
-extern char *xstrdup (const char *) __attribute__ ((__malloc__));
-extern char *xstrndup (const char *, size_t) __attribute__ ((__malloc__));
+#ifndef MIN
+#define MIN(m, n) ((m) < (n) ? (m) : (n))
+#endif
 
 
-extern uint32_t crc32 (uint32_t crc, unsigned char *buf, size_t len);
-extern int crc32_file (int fd, uint32_t *resp);
-
 /* A special gettext function we use if the strings are too short.  */
 #define sgettext(Str) \
   ({ const char *__res = strrchr (gettext (Str), '|');			      \
@@ -142,39 +141,6 @@
 extern char *__cxa_demangle (const char *mangled_name, char *output_buffer,
 			     size_t *length, int *status);
 
-
-
-/* Color handling.  */
-
-/* Command line parser.  */
-extern const struct argp color_argp;
-
-/* Coloring mode.  */
-enum color_enum
-  {
-    color_never = 0,
-    color_always,
-    color_auto
-  } __attribute__ ((packed));
-extern enum color_enum color_mode;
-
-/* Colors to use for the various components.  */
-extern char *color_address;
-extern char *color_bytes;
-extern char *color_mnemonic;
-extern char *color_operand1;
-extern char *color_operand2;
-extern char *color_operand3;
-extern char *color_label;
-extern char *color_undef;
-extern char *color_undef_tls;
-extern char *color_undef_weak;
-extern char *color_symbol;
-extern char *color_tls;
-extern char *color_weak;
-
-extern const char color_off[];
-
 /* A static assertion.  This will cause a compile-time error if EXPR,
    which must be a compile-time constant, is false.  */
 
diff --git a/lib/xstrdup.c b/lib/xstrdup.c
index aa10352..ff1e3d4 100644
--- a/lib/xstrdup.c
+++ b/lib/xstrdup.c
@@ -31,7 +31,7 @@
 #endif
 
 #include <string.h>
-#include "system.h"
+#include "libeu.h"
 
 
 /* Return a newly allocated copy of STRING.  */
diff --git a/lib/xstrndup.c b/lib/xstrndup.c
index 92b79c1..d43e3b9 100644
--- a/lib/xstrndup.c
+++ b/lib/xstrndup.c
@@ -30,8 +30,9 @@
 # include <config.h>
 #endif
 
+#include <stdint.h>
 #include <string.h>
-#include "system.h"
+#include "libeu.h"
 
 
 /* Return a newly allocated copy of STRING.  */
diff --git a/libasm/ChangeLog b/libasm/ChangeLog
index 4c6cb28..fe06007 100644
--- a/libasm/ChangeLog
+++ b/libasm/ChangeLog
@@ -1,3 +1,7 @@
+2015-10-11  Akihiko Odaki  <akihiko.odaki.4i@stu.hosei.ac.jp>
+
+	* asm_align.c: Remove sys/param.h include.
+
 2016-07-08  Mark Wielaard  <mjw@redhat.com>
 
 	* Makefile.am (AM_CPPFLAGS): Add libdwelf.
diff --git a/libasm/asm_align.c b/libasm/asm_align.c
index 6631c4d..e59a070 100644
--- a/libasm/asm_align.c
+++ b/libasm/asm_align.c
@@ -33,7 +33,6 @@
 
 #include <inttypes.h>
 #include <stdlib.h>
-#include <sys/param.h>
 
 #include <libasmP.h>
 #include <system.h>
diff --git a/libcpu/ChangeLog b/libcpu/ChangeLog
index 9cce4e7..fff1d96 100644
--- a/libcpu/ChangeLog
+++ b/libcpu/ChangeLog
@@ -1,3 +1,9 @@
+2015-10-11  Akihiko Odaki  <akihiko.odaki.4i@stu.hosei.ac.jp>
+
+	* i386_lex.l: Remove system.h include, add libeu.h include.
+	* i386_parse.y: Remove sys/param.h include, add libeu.h include.
+	* i386_disasm.c: Remove sys/param.h.
+
 2016-09-05  Mark Wielaard  <mjw@redhat.com>
 
 	* bpf_disasm.c: Define BPF_PSEUDO_MAP_FD if undefined.
diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c
index ceb5164..699dd61 100644
--- a/libcpu/i386_disasm.c
+++ b/libcpu/i386_disasm.c
@@ -41,7 +41,6 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/param.h>
 
 #include "../libebl/libeblP.h"
 
diff --git a/libcpu/i386_lex.l b/libcpu/i386_lex.l
index 1e10dd7..ef1b53b 100644
--- a/libcpu/i386_lex.l
+++ b/libcpu/i386_lex.l
@@ -34,7 +34,7 @@
 #include <error.h>
 #include <libintl.h>
 
-#include <system.h>
+#include <libeu.h>
 #include "i386_parse.h"
 
 
diff --git a/libcpu/i386_parse.y b/libcpu/i386_parse.y
index 689ba22..15a72b1 100644
--- a/libcpu/i386_parse.y
+++ b/libcpu/i386_parse.y
@@ -44,8 +44,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/param.h>
 
+#include <libeu.h>
 #include <system.h>
 
 #define obstack_chunk_alloc xmalloc
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 8071fc1..c2f25ea 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-11  Akihiko Odaki  <akihiko.odaki.4i@stu.hosei.ac.jp>
+
+	* dwarf_getpubnames.c: Remove sys/param.h include, add system.h.
+	* libdw_alloc.c: Likewise.
+
 2016-07-08  Mark Wielaard  <mjw@redhat.com>
 
 	* libdw.map (ELFUTILS_0.167): New. Add dwelf_strtab_init,
diff --git a/libdw/dwarf_getpubnames.c b/libdw/dwarf_getpubnames.c
index 462b6ff..25600f3 100644
--- a/libdw/dwarf_getpubnames.c
+++ b/libdw/dwarf_getpubnames.c
@@ -34,10 +34,10 @@
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/param.h>
 
 #include <libdwP.h>
 #include <dwarf.h>
+#include <system.h>
 
 
 static int
diff --git a/libdw/libdw_alloc.c b/libdw/libdw_alloc.c
index a3b7958..28a8cf6 100644
--- a/libdw/libdw_alloc.c
+++ b/libdw/libdw_alloc.c
@@ -34,8 +34,8 @@
 #include <error.h>
 #include <errno.h>
 #include <stdlib.h>
-#include <sys/param.h>
 #include "libdwP.h"
+#include "system.h"
 
 
 void *
diff --git a/libdwelf/ChangeLog b/libdwelf/ChangeLog
index 4211023..a332655 100644
--- a/libdwelf/ChangeLog
+++ b/libdwelf/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-11  Akihiko Odaki  <akihiko.odaki.4i@stu.hosei.ac.jp>
+
+	* dwelf_strtab.c: Remove sys/param.h include.
+	(MIN): Remove definition.
+
 2016-07-08  Mark Wielaard  <mjw@redhat.com>
 
 	* Makefile.am (libdwelf_a_SOURCES): Add dwelf_strtab.c.
diff --git a/libdwelf/dwelf_strtab.c b/libdwelf/dwelf_strtab.c
index c1b93d4..01e091c 100644
--- a/libdwelf/dwelf_strtab.c
+++ b/libdwelf/dwelf_strtab.c
@@ -38,15 +38,10 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/param.h>
 
 #include "libdwelfP.h"
 #include <system.h>
 
-#ifndef MIN
-# define MIN(a, b) ((a) < (b) ? (a) : (b))
-#endif
-
 
 struct Dwelf_Strent
 {
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 3332db7..27c5d6e 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,13 @@
+2015-10-11  Akihiko Odaki  <akihiko.odaki.4i@stu.hosei.ac.jp>
+
+	* core-file.c: Remove sys/param.h.
+	* dwfl_segment_report_module.c: Likewise. Add system.h include.
+	(MAX): Remove definition.
+	* frame_unwind.c: Add system.h include.
+	(MAX): Remove definition.
+	* linux-core-attach.c (MIN): Remove definition.
+	* linux-pid-attach.c (MAX): Likewise.
+
 2016-08-12  Mark Wielaard  <mjw@redhat.com>
 
 	* link_map.c (dwfl_link_map_report): Fix assert, set in.d_size.
diff --git a/libdwfl/core-file.c b/libdwfl/core-file.c
index 67684c9..84cb89a 100644
--- a/libdwfl/core-file.c
+++ b/libdwfl/core-file.c
@@ -32,7 +32,6 @@
 #include "libdwflP.h"
 #include <gelf.h>
 
-#include <sys/param.h>
 #include <unistd.h>
 #include <endian.h>
 #include <byteswap.h>
diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c
index 40553c9..207a257 100644
--- a/libdwfl/dwfl_segment_report_module.c
+++ b/libdwfl/dwfl_segment_report_module.c
@@ -35,11 +35,12 @@
 #include <elf.h>
 #include <gelf.h>
 #include <inttypes.h>
-#include <sys/param.h>
 #include <endian.h>
 #include <unistd.h>
 #include <fcntl.h>
 
+#include <system.h>
+
 
 /* A good size for the initial read from memory, if it's not too costly.
    This more than covers the phdrs and note segment in the average 64-bit
@@ -53,10 +54,6 @@
 # define MY_ELFDATA	ELFDATA2MSB
 #endif
 
-#ifndef MAX
-# define MAX(a, b) ((a) > (b) ? (a) : (b))
-#endif
-
 
 /* Return user segment index closest to ADDR but not above it.
    If NEXT, return the closest to ADDR but not below it.  */
diff --git a/libdwfl/frame_unwind.c b/libdwfl/frame_unwind.c
index a885446..fb42c1a 100644
--- a/libdwfl/frame_unwind.c
+++ b/libdwfl/frame_unwind.c
@@ -35,6 +35,7 @@
 #include "libdwflP.h"
 #include "../libdw/dwarf.h"
 #include <sys/ptrace.h>
+#include <system.h>
 
 /* Maximum number of DWARF expression stack slots before returning an error.  */
 #define DWARF_EXPR_STACK_MAX 0x100
@@ -43,10 +44,6 @@
    error.  */
 #define DWARF_EXPR_STEPS_MAX 0x1000
 
-#ifndef MAX
-# define MAX(a, b) ((a) > (b) ? (a) : (b))
-#endif
-
 bool
 internal_function
 __libdwfl_frame_reg_get (Dwfl_Frame *state, unsigned regno, Dwarf_Addr *val)
diff --git a/libdwfl/linux-core-attach.c b/libdwfl/linux-core-attach.c
index 5a7b3b3..93d0e46 100644
--- a/libdwfl/linux-core-attach.c
+++ b/libdwfl/linux-core-attach.c
@@ -32,10 +32,6 @@
 
 #include "../libdw/memory-access.h"
 
-#ifndef MIN
-# define MIN(a, b) ((a) < (b) ? (a) : (b))
-#endif
-
 struct core_arg
 {
   Elf *core;
diff --git a/libdwfl/linux-pid-attach.c b/libdwfl/linux-pid-attach.c
index c13f2b6..adfc7f8 100644
--- a/libdwfl/linux-pid-attach.c
+++ b/libdwfl/linux-pid-attach.c
@@ -37,10 +37,6 @@
 #include <sys/syscall.h>
 #include <unistd.h>
 
-#ifndef MAX
-# define MAX(a, b) ((a) > (b) ? (a) : (b))
-#endif
-
 #ifdef __linux__
 
 static bool
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 7799144..cf672bf 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,11 @@
+2015-10-11  Akihiko Odaki  <akihiko.odaki.4i@stu.hosei.ac.jp>
+
+	* elf32_updatefile.c: Remove sys/param.h include.
+	* elf32_updatenull.c: Likewise. Add system.h include.
+	* elf_begin.c: Remove sys/param.h.
+	* elf_compress: Likewise. Add system.h include.
+	(MAX): Remove definition.
+
 2016-08-07  Mark Wielaard  <mjw@redhat.com>
 
 	* elf_compress.c (__libelf_reset_rawdata): Check scn->flags and
diff --git a/libelf/elf32_updatefile.c b/libelf/elf32_updatefile.c
index d0fabb1..8dd85d1 100644
--- a/libelf/elf32_updatefile.c
+++ b/libelf/elf32_updatefile.c
@@ -39,7 +39,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/mman.h>
-#include <sys/param.h>
 
 #include <system.h>
 #include "libelfP.h"
diff --git a/libelf/elf32_updatenull.c b/libelf/elf32_updatenull.c
index 939aa13..d83c0b3 100644
--- a/libelf/elf32_updatenull.c
+++ b/libelf/elf32_updatenull.c
@@ -36,8 +36,8 @@
 #include <libelf.h>
 #include <stdbool.h>
 #include <string.h>
-#include <sys/param.h>
 
+#include <system.h>
 #include "libelfP.h"
 #include "elf-knowledge.h"
 
diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c
index 147f5f4..8fdb376 100644
--- a/libelf/elf_begin.c
+++ b/libelf/elf_begin.c
@@ -40,7 +40,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/mman.h>
-#include <sys/param.h>
 #include <sys/stat.h>
 
 #include <system.h>
diff --git a/libelf/elf_compress.c b/libelf/elf_compress.c
index 3aebe82..dac0ac6 100644
--- a/libelf/elf_compress.c
+++ b/libelf/elf_compress.c
@@ -31,20 +31,16 @@
 #endif
 
 #include <libelf.h>
+#include <system.h>
 #include "libelfP.h"
 #include "common.h"
 
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/param.h>
 #include <unistd.h>
 #include <zlib.h>
 
-#ifndef MAX
-# define MAX(a, b) ((a) > (b) ? (a) : (b))
-#endif
-
 /* Cleanup and return result.  Don't leak memory.  */
 static void *
 do_deflate_cleanup (void *result, z_stream *z, void *out_buf,
diff --git a/src/ChangeLog b/src/ChangeLog
index 70d11f2..68baa2e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,18 @@
+2015-10-11  Akihiko Odaki  <akihiko.odaki.4i@stu.hosei.ac.jp>
+
+	* arlib.c: Remove system.h include, add libeu.h include.
+	* arlib2.c: Remove sys/param.h include.
+	* elfcompress.c: Add libeu.h include.
+	* elflint.c: Remove sys/param.h include, add libeu.h include.
+	* nm.c: Likewise.
+	* objdump.c: Likewise.
+	* ranlib.c: Likewise.
+	* readelf.c: Likewise.
+	* size.c: Remove sys/param.h include.
+	* strings.c: Likewise, add libeu.h include.
+	* strip.c: Likewise.
+	* unstrip.c: Likewise.
+
 2016-10-06  Mark Wielaard  <mjw@redhat.com>
 
 	* strip.c (handle_elf): Don't remove real symbols from allocated
diff --git a/src/arlib.c b/src/arlib.c
index 43a9145..c3cf47f 100644
--- a/src/arlib.c
+++ b/src/arlib.c
@@ -28,7 +28,7 @@
 #include <stdlib.h>
 #include <time.h>
 
-#include <system.h>
+#include <libeu.h>
 
 #include "arlib.h"
 
diff --git a/src/arlib2.c b/src/arlib2.c
index 7998fc6..553fc57 100644
--- a/src/arlib2.c
+++ b/src/arlib2.c
@@ -24,7 +24,6 @@
 #include <libintl.h>
 #include <limits.h>
 #include <string.h>
-#include <sys/param.h>
 
 #include "arlib.h"
 
diff --git a/src/elfcompress.c b/src/elfcompress.c
index 86cc716..7392cb7 100644
--- a/src/elfcompress.c
+++ b/src/elfcompress.c
@@ -34,6 +34,7 @@
 #include ELFUTILS_HEADER(ebl)
 #include ELFUTILS_HEADER(dwelf)
 #include <gelf.h>
+#include "libeu.h"
 #include "system.h"
 
 /* Name and version of program.  */
diff --git a/src/elflint.c b/src/elflint.c
index 8c298c9..8b52ee2 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -35,9 +35,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/stat.h>
-#include <sys/param.h>
 
 #include <elf-knowledge.h>
+#include <libeu.h>
 #include <system.h>
 #include "../libelf/libelfP.h"
 #include "../libelf/common.h"
diff --git a/src/nm.c b/src/nm.c
index 010469d..37e54bf 100644
--- a/src/nm.c
+++ b/src/nm.c
@@ -41,8 +41,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/param.h>
 
+#include <libeu.h>
 #include <system.h>
 #include "../libebl/libeblP.h"
 #include "../libdwfl/libdwflP.h"
diff --git a/src/objdump.c b/src/objdump.c
index 0aa41e8..1afcd57 100644
--- a/src/objdump.c
+++ b/src/objdump.c
@@ -32,8 +32,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/param.h>
 
+#include <libeu.h>
 #include <system.h>
 #include "../libebl/libeblP.h"
 
diff --git a/src/ranlib.c b/src/ranlib.c
index c93c5ac..455de0d 100644
--- a/src/ranlib.c
+++ b/src/ranlib.c
@@ -35,7 +35,6 @@
 #include <stdio_ext.h>
 #include <unistd.h>
 #include <sys/mman.h>
-#include <sys/param.h>
 #include <sys/stat.h>
 
 #include <system.h>
diff --git a/src/readelf.c b/src/readelf.c
index f157290..204aeec 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -40,10 +40,10 @@
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
-#include <sys/param.h>
 #include <sys/stat.h>
 #include <signal.h>
 
+#include <libeu.h>
 #include <system.h>
 #include "../libelf/libelfP.h"
 #include "../libelf/common.h"
diff --git a/src/size.c b/src/size.c
index 7c03cce..b98674c 100644
--- a/src/size.c
+++ b/src/size.c
@@ -34,7 +34,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/param.h>
 
 #include <system.h>
 
diff --git a/src/strings.c b/src/strings.c
index c1d63cd..a4ffcbe 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -38,9 +38,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/mman.h>
-#include <sys/param.h>
 #include <sys/stat.h>
 
+#include <libeu.h>
 #include <system.h>
 
 #ifndef MAP_POPULATE
diff --git a/src/strip.c b/src/strip.c
index 819b67e..64ef84d 100644
--- a/src/strip.c
+++ b/src/strip.c
@@ -36,13 +36,13 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/param.h>
 #include <sys/stat.h>
 #include <sys/time.h>
 
 #include <elf-knowledge.h>
 #include <libebl.h>
 #include "libdwelf.h"
+#include <libeu.h>
 #include <system.h>
 
 typedef uint8_t GElf_Byte;
diff --git a/src/unstrip.c b/src/unstrip.c
index 4673738..3bf4b19 100644
--- a/src/unstrip.c
+++ b/src/unstrip.c
@@ -49,6 +49,7 @@
 #include <libebl.h>
 #include <libdwfl.h>
 #include "libdwelf.h"
+#include "libeu.h"
 #include "system.h"
 
 #ifndef _
diff --git a/tests/ChangeLog b/tests/ChangeLog
index a0eb4c6..31904e7 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2015-10-11  Akihiko Odaki  <akihiko.odaki.4i@stu.hosei.ac.jp>
+
+	* arextract.c: Remove sys/param.h include, add system.h include.
+
 2016-08-30  Mark Wielaard  <mjw@redhat.com>
 
 	* Makefile.am (asm_tst?_LDADD): Add libdw.
diff --git a/tests/arextract.c b/tests/arextract.c
index 21850b6..2c4dc75 100644
--- a/tests/arextract.c
+++ b/tests/arextract.c
@@ -25,7 +25,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/param.h>
+#include <system.h>
 
 
 int