summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac6
-rw-r--r--lib/Makefile.am11
-rw-r--r--lib/features.h.in43
-rw-r--r--libelf/Makefile.am9
-rw-r--r--tests/Makefile.am6
5 files changed, 73 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index e4b2946d..1e7778df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -124,6 +124,12 @@ AS_HELP_STRING([--enable-gnulib],
use_gnulib=$enableval, use_gnulib=no)
AM_CONDITIONAL(USE_GNULIB, test "$use_gnulib" = yes)
+AC_ARG_ENABLE([selfcontained],
+AS_HELP_STRING([--enable-selfcontained],
+ [install extra headers to enable including and linking the libraries on non-GNU systems]),
+ selfcontained=$enableval, selfcontained=no)
+AM_CONDITIONAL(SELFCONTAINED, test "$selfcontained" = yes)
+
AC_PROG_CC
gl_EARLY
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 17d16d07..87a922ae 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -39,8 +39,17 @@ libeu_a_SOURCES = xstrdup.c xstrndup.c xmalloc.c next_prime.c \
noinst_HEADERS = fixedsizehash.h libeu.h system.h dynamicsizehash.h list.h \
md5.h sha1.h eu-config.h color.h printversion.h
-EXTRA_DIST = dynamicsizehash.c
+EXTRA_DIST = dynamicsizehash.c features.h.in
if !GPROF
xmalloc_CFLAGS = -ffunction-sections
endif
+
+if SELFCONTAINED
+install: install-am features.h.in
+ $(mkinstalldirs) $(DESTDIR)$(includedir)
+ $(INSTALL_HEADER) $(top_srcdir)/lib/features.h.in $(DESTDIR)$(includedir)/features.h
+
+uninstall: uninstall-am
+ rm -f $(DESTDIR)$(includedir)/features.h
+endif
diff --git a/lib/features.h.in b/lib/features.h.in
new file mode 100644
index 00000000..099f4211
--- /dev/null
+++ b/lib/features.h.in
@@ -0,0 +1,43 @@
+/* This file defines uid_t, gid_t, mode_t, pid_t
+ Copyright (C) 2017 The Qt Company Ltd
+ 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 _FEATURES_H
+#define _FEATURES_H 1
+
+#include <stdint.h>
+
+typedef uint32_t uid_t;
+typedef uint32_t gid_t;
+typedef uint32_t mode_t;
+#ifdef _WIN64
+typedef int64_t pid_t
+#else
+typedef int32_t pid_t;
+#endif
+
+#endif /* features.h */
diff --git a/libelf/Makefile.am b/libelf/Makefile.am
index 3286ddad..1a2b85a9 100644
--- a/libelf/Makefile.am
+++ b/libelf/Makefile.am
@@ -141,9 +141,16 @@ uninstall: uninstall-am uninstall-lib
rm -f $(DESTDIR)$(libdir)/$(libelf_SONAME)
rm -f $(DESTDIR)$(libdir)/$(libelf_BARE)
-noinst_HEADERS = elf.h abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
+noinst_HEADERS = abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
version_xlate.h gnuhash_xlate.h note_xlate.h dl-hash.h \
chdr_xlate.h
+
+if SELFCONTAINED
+include_HEADERS += elf.h
+else
+noinst_HEADERS += elf.h
+endif
+
EXTRA_DIST = libelf.map
CLEANFILES += $(am_libelf_pic_a_OBJECTS) $(libelf_SONAME) $(libelf_BARE)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d801681f..2e80b8b9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -502,9 +502,15 @@ emptyfile_LDADD = $(libelf) $(libgnu)
vendorelf_LDADD = $(libelf) $(libgnu)
fillfile_LDADD = $(libelf) $(libgnu)
+if SELFCONTAINED
+# In self contained mode we cannot expect a system elf header.
+# Use our own then
+system_elf_libelf_test_CPPFLAGS = -I$(top_srcdir)/libelf
+else
# We want to test the libelf header against the system elf.h header.
# Don't include any -I CPPFLAGS.
system_elf_libelf_test_CPPFLAGS =
+endif
if USE_GNULIB
system_elf_libelf_test_CPPFLAGS += -I$(top_srcdir)/libgnu -I$(top_builddir)/libgnu
endif