Commit Graph

43 Commits

Author SHA1 Message Date
Dodji Seketeli
28090bad1b Make the support of RPM and DEB package formats conditional
If at configure time the libabigail source tarball detects that
rpm2cpio and cpio are present then it enables the support for rpm
files.  Users can explicitly enable or disable that support by passing
--enable-rpm or --disable-rpm to configure.

Similarly if it detects that dpkg is present at configure time then it
enables the support for deb files.  Users can explicitly enable or
disable that support by passing --enable-deb or --disable-deb to
configure.

	* config.h.in: Define WITH_DEB and WITH_RPM pre-processor macros.
	* configure.ac: Add --enable-{rpm,deb} switches.  Check for
	rpm2cpio and cpio programs, unless --disable-rpm was provided.  If
	they are found and if --enable-rpm=auto was provided, then
	consider that --enable-rpm=yes was provided.  In that case, set
	the WITH_RPM macro to 1.  Otherwise, undefine that macro.
	Similarly, check for dpkg unless --disable-deb was provided.  If
	it's found and if --enable-deb=auto was provided, consider that
	--enable-deb=yes was provided.  In that case, set the WITH_DEB
	macro to 1.  Otherwise, undefine that macro.  Define the
	ENABLE_RPM and ENABLE_DEB conditional automake variables, if the
	rpm resp. deb support is enabled.  Emit a notice about the rpm and
	deb features being enabled or not, at the end of the configure
	process.
	* tests/test-diff-pkg.cc: Include the config.h header.
	(in_out_spec): Guard rpm tests by the WITH_RPM macro.  Similarly,
	guard deb tests by the WITH_DEB macro.
	* tools/abipkgdiff.cc: Include the config.h header.
	(extract_rpm): Guard this function definition with the WITH_RPM
	macro.
	(extract_deb): Guard this function definition with the WITH_DEB
	macro.
	(extract_package): Guard the handling of rpm packages with the
	WITH_RPM macro and the handling of deb package with the WITH_DEB
	macro.  If a package not-support package format is encountered,
	emit an appropriate error message and error out.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-14 13:40:32 +02:00
Dodji Seketeli
393fe3166b Add configure check for rm and mkdir used by abipkgdiff
* configure.ac: Add configure checks for rm and mkdir used by
	abipkgdiff.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-14 13:31:30 +02:00
Dodji Seketeli
9d601b2663 Fix a comment in configure.ac
* configure.ac: Fix a comment.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-14 13:31:30 +02:00
Dodji Seketeli
944025e006 Enable large file support
Mattias Klose reported that building libabigail in the Debian build
system raised an error because the libabigail binaries were built
without the Large File Support (LFS), as described by
https://lintian.debian.org/tags/binary-file-built-without-LFS-support.html.

This just calls the configure macro AC_SYS_LARGEFILE for that.

	* configure.ac: Call the AC_SYS_LARGEFILE autoconf macro.
	* config.h.in: Update.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-23 12:30:27 +02:00
Dodji Seketeli
5b07d709ab Do not build zip archive support by default
Until now, the zip archive support was automatically built if the
libzip dependent library was installed on the system at configure
time.  As we are planning to remove the zip support, let's first
disable the support by default, even if libzip is installed at
configure time.

	* configure.ac: By default, unconditionally disable the
	zip-archive support.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-06-23 12:21:30 +02:00
Dodji Seketeli
18bbfb5ec3 Fix archive writing support
The runtestwritereadarchive test is failing on Rawhide (Fedora 23) for
me now.  It appears it was because the content to write to the zip
archive is in a buffer which is stored in a vector of buffers.

When the vector grows, the buffers are potentially copied over, and
the old buffers are destroyed, making the address of the old buffers
being stalled.  But then those old address are used by the code that
write stuff in the zip archive.  Ooops.

This patch essentially replaces the vector of buffer with a list, so
that growing the list doesn't invalidate the buffers.  The patch also
does away with using deprecated APIs of libzip.

	* configure.ac: Require libzip 0.10.1 at least.
	* src/abg-writer.cc (archive_write_ctxt::serialized_tus): Make
	this be a list<string>, rather than a vector<string>.
	(create_archive_write_context): Truncate the archive if it exists
	already.
	(write_translation_unit_to_archive): Do not use the deprecated
	zip_add() function anymore.  Rather, use zip_file_add().
	* tests/test-write-read-archive.cc (main): Double check if the
	translation unit we read is empty or not.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-04-24 19:59:19 +02:00
Sinny Kumari
388f990681 Check if EM_AARCH64, EM_TILEPRO and EM_TILEGX macros are defined in elf.h
Macros EM_AARCH64, EM_TILEPRO and EM_TILEGX were defined in diffrent
commits and release of glibc which is glibc 2.16 and 2.17 in elf/elf.h
file. Compiling libabigail was failing duing to undefined behaviour of
above macros in older glibc release. To solve it, configure.ac checks
whether these macros are defined or not and sets accordinlgy
HAVE_EM_AARCH64_MACRO, HAVE_EM_TILEPRO_MACRO and HAVE_EM_TILEGX_MACRO
macros.

	* config.h.in: Generated autoheader by configure.ac
	for added macros
	* configure.ac: Defining HAVE_EM_AARCH64_MACRO,
	HAVE_EM_TILEPRO_MACRO and HAVE_EM_TILEGX_MACRO to check
	whether EM_AARCH64, EM_TILEPRO and EM_TILEGX macros are defined
	in elf.h or not
	* src/abg-dwarf-reader.cc (e_machine_to_string): Look for
	EM_AARCH64, EM_TILEPRO and EM_TILEGX macros only
	if they are defined in elf.h

Signed-off-by: Sinny Kumari <sinny@redhat.com>
2015-03-31 23:13:34 +05:30
Dodji Seketeli
8b28d171c3 Canonicalize types either early or late after TU reading
While trying to diff two identical files (abidiff foo.so foo.so) it
appeared that canonicalizing types during e.g, the DWARF reading
process was leading to subtle errors because it's extremely hard to
know when a type is complete.  That is, during the building of a class
type C, a pointer to C can be built before C is complete.  Worse, even
after reading the DIE (from DWARF) of class C, there can be DIE seen
later in the translation unit that modifies type C.  In these late
cases, one needs to wait -- not only until C is fully built, but also
sometimes, after the translation unit is fully built -- to
canonicalize C and then the pointer to C.  This kind of things.

So now there are two possible points in time when canonicalization of
a type can happen.  It can happen early, when the type is built.  This
is the case for basic types and composite types for which all
sub-types are canonicalized already.  It can happen late, right after
we've finished reading the debug info for the current translation
unit.

So this patch fixes the IR traversal and uses that to walk the
translation unit (or even types) after it's built.  It does away with
the first attempt to perform early canonicalizing only.

The patch also handles type canonicalizing while reading xml-abi
format.

	* include/abg-fwd.h (is_class_type)
	(type_has_non_canonicalized_subtype): Declare new functions.
	(is_member_type): Remove the overload that takes a decl_base_sptr.
	It's superfluous.  We just need the one that takes a
	type_base_sptr.
	* include/abg-ir.h (translation_unit::{is_constructed,
	set_is_constructed}): Add new methods.
	(class_decl::has_virtual_member_functions): Likewise.
	(class decl_base): Makes it virtually inherit ir_traversable_base.
	(class type_base): Make this virtually inherit traversable_base
	too.
	(type_base::canonicalize): Renamed enable_canonical_equality
	into this.
	(type_base::traverse): Declare new virtual method.
	(canonicalize): Renamed enable_canonical_equality into this.
	(scope_type_decl::traverse): Declare new virtual method.
	(namespace_decl::get_pretty_representation): Declare new virtual
	method.
	(function_type::traverse): Likewise.
	(class_decl::base_spec::traverse): Likewise.
	(ir_node_visitor::visit): Remove the overloads and replace each of
	them with a pair of ...
	(ir_node_visitor::{visit_begin, visit_end}): ... of these.
	* include/abg-traverse.h (traversable_base::visiting): New
	method.
	(traversable_base::visiting_): New data member.
	(traversable_base::traversable_base): New constructor.
	* src/abg-ir.cc ({scope_decl, type_decl, namespace_decl,
	qualified_type_def, pointer_type_def, reference_type_def,
	array_type_def, enum_type_decl, typedef_decl, var_decl,
	function_decl, function_decl::parameter, class_decl,
	class_decl::member_function_template,
	class_decl::member_class_template, function_tdecl,
	class_tdecl}::traverse): Fix this to properly set the
	traversable_base::visiting_ flag and to reflect the new signatures
	of the ir_node_visitor methods.
	({type_base, scope_type_decl, function_type,
	class_decl::base_spec}::traverse): New method.
	(type_base::get_canonical_type_for): Handle the case of the type
	already having a canonical type.  Properly hash the type using the
	dynamic type hasher.  Look through declaration-only classes to
	consider the definition of the class instead.  Fix logic to have a
	single pointer of return, to ease debugging.
	(canonicalize): Renamed enable_canonical_equality into this.
	(namespace_decl::get_pretty_representation): Define new method.
	(ir_node_visitor::visit): Replace each of these overloads with a
	pair of visit_begin/visit_end ones.
	(translation_unit::priv::is_constructed_): New data member.
	(translation_unit::priv::priv): Initialize it.
	(translation_unit::{is_constructed, set_is_constructed}): Define
	new methods.
	(is_member_type(const decl_base_sptr)): Remove.
	(is_class_type(decl_base *d)): Define new function.
	(class_decl::has_virtual_member_functions): Define new method.
	(equals(const class_decl&, const class_decl&, change_kind*)): If
	the containing translation unit is not constructed yet, do not
	take virtual member functions in account when comparing the
	classes.  This is because when reading from DWARF, there can be
	DIEs that change the number of virtual member functions after the
	DIE of the class.  So one needs to start taking virtual members
	into account only after the translation unit has been constructed.
	(class non_canonicalized_subtype_detector): Define new type.
	(type_has_non_canonicalized_subtype): Define new function.
	* src/abg-corpus.cc (symtab_build_visitor_type::visit): Renamed
	this into symtab_build_visitor_type::visit_end.
	* src/abg-dwarf-reader.cc (die_type_map_type): New typedef.
	(die_class_map_type): This is now a typedef on a map of
	Dwarf_Off/class_decl_sptr.
	(read_context::{die_type_map_, alternate_die_type_map_,
	types_to_canonicalize_, alt_types_to_canonicalize_}): New data
	members.
	(read_context::{associate_die_to_decl,
	associate_die_to_decl_primary}): Make these methods public.
	(read_context::{associate_die_to_type,
	lookup_type_from_die_offset, is_wip_class_die_offset,
	types_to_canonicalize, schedule_type_for_canonicalization}):
	Define new methods.
	(build_type_decl, build_enum_type)
	(build_class_type_and_add_to_ir, build_qualified_type)
	(build_pointer_type_def, build_reference_type, build_array_type)
	(build_typedef_type, build_function_decl): Do not canonicalize
	types here.
	(maybe_canonicalize_type): Define new function.
	(build_ir_node_from_die): Take a new flag that says if the ir node
	is a member type/function or not. Early-canonicalize base types.
	Canonicalize composite types that have only canonicalized
	sub-types.  Schedule the other types for late canonicalizing.  For
	class types, early canonicalize those that are non-member types,
	that are fully constructed and that have only canonicalized
	sub-types.  Adjust to the new signature of build_ir_node_from_die.
	(get_scope_for_die, build_namespace_decl_and_add_to_ir)
	(build_qualified_type, build_pointer_type_def)
	(build_reference_type, build_array_type, build_typedef_type)
	(build_var_decl, build_function_decl): Adjust for the new
	signature of build_ir_node_from_die.
	(build_translation_unit_and_add_to_ir): Likewise.  Perform the
	late canonicalizing of the types that have been scheduled for
	that.
	(build_class_type_and_add_to_ir): Return a class_decl_sptr, not a
	decl_base_sptr.  Adjust for the new signature of
	build_ir_node_from_die.  Early canonicalize member types that are
	created and added to a given class, or schedule them for late
	canonicalizing.
	* src/abg-reader.cc (class read_context::{m_wip_classes_map,
	m_types_to_canonicalize}): New data members.
	(read_context::{clear_types_to_canonicalize,
	clear_wip_classes_map, mark_class_as_wip, unmark_class_as_wip,
	is_wip_class, maybe_canonicalize_type,
	schedule_type_for_late_canonicalizing,
	perform_late_type_canonicalizing}): Add new method definitions.
	(read_context::clear_per_translation_unit_data): Call
	read_context::clear_types_to_canonicalize().
	(read_translation_unit_from_input): Call
	read_context::perform_late_type_canonicalizing() at the end of the
	function.
	(build_function_decl): Fix the function type canonicalizing (per
	translation) that was already in place.  Do the canonicalizing of
	these only when the type is fully built.  Oops.  This was really
	brokend.  Also, when the function type is constructed, consider it
	for type canonicalizing.
	(build_type_decl): Early canonicalize basic types.
	(build_qualified_type_decl, build_pointer_type_def)
	(build_pointer_type_def, build_reference_type_def)
	(build_array_type_def, build_enum_type_decl, build_typedef_decl):
	Handle the canonicalizing for these composite types: either early
	or late.
	(build_class_decl): Likewise.  Also, mark this class a 'being
	built' until it's fully built.  This helps the canonicalizing code
	to know that it should leave a class alone until it's fully built.
	* tests/test-ir-walker.cc (struct name_printing_visitor): Adjust
	to the visitor methods naming change.
	* configure.ac: Generate the tests/runtestcanonicalizetypes.sh
	testing script from tests/runtestcanonicalizetypes.sh.in.
	* tests/runtestcanonicalizetypes.sh.in: Add the template for the
	new runtestcanonicalizetypes.sh script that test for type
	canonicalizing.
	* tests/Makefile.am: Add the new runtestcanonicalizetypes.sh
	regression testing script to the build system.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-02-18 21:32:37 +01:00
Dodji Seketeli
a00ed6bf41 Hand-code the string representation of GElf_Ehdr::e_machine
I was using elfutils/libebl.h to get a string representation of the
marchine architecture of the elf file.  It appears elfutils/libebl.h
is an internal header not meant to be used by client code of
elfutils.  So this patch hand-codes the string representation of the
value of the GElf_Ehdr data member and does away with the need of the
elfutils/libebl.h header as with libebl.

	* configure.ac: Do not check for elfutils/libebl.h and libebl.a
	anymore.
	* src/abg-dwarf-reader.cc: Do not include elfutils/libebl.h
	anymore.
	(e_machine_to_string): Define new static
	function.
	(read_context::::load_elf_architecture): Use the new
	e_machine_to_string() function rather than ebl_backend_name() and
	ebl_openbackend().
	* tests/data/test-diff-dwarf/test-23-diff-arch-report-0.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-26 22:17:39 +01:00
Dodji Seketeli
1516a78cae Bump the candidate version of the library to 1.0
I think the current status of the source code is closer to a 1.0
status than a 1.0 one.

	* configure.ac: Bump version to 1.0.0

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-13 11:34:15 +01:00
Dodji Seketeli
929db0a880 Detect and report changes in ELF architecture
Libabigail does not take in account the architecture of the ELF file
it reads.  This patch changes that to represent the ELF architecture
as a string, detect when that architecture changes accross two corpora
being compared and emit a report about that change.

	* configure.ac: Detect the presence of libebl.a and add it to the
	list of library we depend on to build libabigail.  Report when
	libelf.so is not found.
	* include/abg-comparison.h:
	(diff_context::show_architecture_change): Declare new accessors.
	(corpus_diff::architecture_changed): Declare new method.
	* include/abg-corpus.h (corpus::{get,set}_architecture_name):
	Declare new accessors.
	* src/abg-comparison.cc
	(diff_context::priv::show_architecture_change_): New data member.
	(diff_context::priv::priv): Initialize it.
	(diff_context::show_architecture_change): Define new accessors.
	(function_decl_diff::report): Report when the size/alignment of
	the function address changes.
	(corpus_diff::priv::architectures_equal_): New data member.
	(corpus_diff::priv::priv): Initialize it.
	(corpus_diff::priv::emit_diff_stats): Take in account changes of
	architecture.
	(corpus_diff::architecture_changed): Define new method.
	(corpus_diff::length): Take in account changes of architecture.
	(corpus_diff::report): Report about changes of architecture.
	(compute_diff): In the overload for corpus_diff_sptr, detect
	changes fo architecture.
	* src/abg-corpus.cc (corpus_priv::architecture_name): Define new
	data member.
	(corpus::{get,set}_architecture_name): Define new method.
	* src/abg-dwarf-reader.cc: Include elfutils/libebl.h to use
	ebl_openbackend() and ebl_backend_name()
	(read_context::elf_architecture_): Define new data member.
	(read_context::elf_architecture): Define new accessor.
	(read_context::{load_elf_architecture, load_remaining_elf_data}):
	Define new methods.
	(read_corpus_from_elf): Use ctxt.load_remaining_elf_data() in lieu
	of ctxt.load_dt_soname_and_needed.  Stick the architecture into
	the corpus.
	* src/abg-reader.cc (read_corpus_from_input): Read the
	'architecture' XML property.
	* src/abg-writer.cc (write_corpus_to_native_xml): Write the
	'architecture' XML property.
	* tests/data/test-diff-dwarf/libtest-23-diff-arch-v0-32.so: New
	test input file.
	* tests/data/test-diff-dwarf/libtest-23-diff-arch-v0-64.so:
	Likewise.
	* tests/data/test-diff-dwarf/test-23-diff-arch-report-0.txt:
	Likewise.
	* tests/data/test-diff-dwarf/test-23-diff-arch-v0.cc: Source code
	for the binary test input files above.
	* tests/data/Makefile.am: Add the new test input files to the
	source distribution.
	* tests/test-diff-dwarf.cc (in_out_specs): Add the new test input
	data to the set of input data to run this test harness over.
	* tests/test-read-dwarf.cc (main): Do not take the architecture in
	account during comparisons.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-07 17:52:10 +01:00
Dodji Seketeli
05615c95d8 Enable parallel tests
* configure.ac (AM_INIT_AUTOMAKE): Enable parallel tests by
	switching on the parallel-tests option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-12-28 11:37:49 +01:00
Jan Engelhardt
112432bbd2 Fix conditional build wrt zip archives and cx11
Revert 1b4e3844e9. Automake does support
nested conditionals just fine.  One just has to use the += operator.

This also fixes the problem:

	./configure: line 15878: ENABLE_ZIP_ARCHIVE_AND_CXX11:
	command not found

caused by bad syntax:

	ENABLE_ZIP_ARCHIVE_AND_CXX11 = yes

(Variable assignments must not use spaces around '=').

	* configure.ac: remove (broken) assignment to the
	ENABLE_ZIP_ARCHIVE_AND_CXX11 variable
	* Makefile.am: replace variable assignments to
	ZIP_ARCHIVE_TESTS_FIRST_PART, ZIP_ARCHIVE_TESTS_SECOND_PART
	by ZIP_ARCHIVE_TESTS using the "+=" automake operator.
	Likewise for CXX11_TESTS.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-12-10 14:35:55 +01:00
Dodji Seketeli
5c19aa1061 Make tests/data directory have its own Makefile
On RHEL 6, make distcheck was trying to compile the C++ files that are
in tests/data.  Having a dedicated tests/data Makefile.am which only
put the data files into an EXTRA_DIST variable fixes that.

	* configure.ac(AC_CONFIG_FILE): Generate a new tests/data/Makefile
	file.
	* tests/Makefile.am: Link the data/ sub-directory from here.  Move
	the EXTRA_DIST definition to ...
	* tests/data/Makefile.am: ... this new file here.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-11-20 11:26:30 +01:00
Dodji Seketeli
c5ac6e828b Cleanup of configure.ac
* configure.ac: Remove useless variables and fix a typo.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-11-19 17:38:38 +01:00
Dodji Seketeli
52a33575b3 Make the install-html target of apidoc/manual be conditional
When running 'make distcheck', make install is automatically run,
which runs 'make install-html', especially in the apidoc and manual
sub-directories.  That triggers the building of the documentation,
using doxygen and python-sphinx even when these two packages are not
installed; in this case, install-html fails because doxygen or or the
python-sphinx binary is not found.  So this patch conditionnaly make the
install-html target run.  To run them, one must enable the building of
the apidoc or the manuals.  Note that just installing doxygen or
python-sphinx enables the building of the apidoc and the manuals.

	* configure.ac: add --enable-apidoc and --enable-manual.  Add the
	two ENABLE_APIDOC and ENABLE_MANUAL automake conditional
	variables.  Add the activation of the apidoc and manual into the
	final package configuration report.
	* doc/Makefile.am: Make the install-html, install-data-local and
	uninstall-local targets conditional on the ENABLE_APIDOC
	conditional variable.
	* doc/manuals/Makefile.am: Likewise, make the install-html,
	install-data-local and uninstall-data-local conditional on the
	ENABLE_MANUAL conditional variable.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-11-19 17:08:10 +01:00
Dodji Seketeli
479d8fa6d8 Use the POSIX 1003.1-1988 tar format for dist tar
* configure.ac: For the tar invocation made by make dist, make
	sure to use the POSIX 1003.1-1988 tar format that can support file
	names of more than 99 characters.  This is useful for the
	test-alt-dwarf-file test that has data made of a file which patch
	has more than 99 characters.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-11-19 15:38:51 +01:00
Dodji Seketeli
1b4e3844e9 Nested automake conditionals don't work
* configure.ac (ENABLE_ZIP_ARCHIVE_AND_CXX11): Define this
	automake condition variable that is true if both the zip archive
	and c++11 features are enabled.  This is important to know if the
	test runtestdot is going to be compiled.  That test needs both
	c++11 and the zip archive features.
	* tests/Makefile.am: Do not nest automake conditional statements.
	It does not work.  Rather, use the new
	ENABLE_ZIP_ARCHIVE_AND_CXX11 condition variable.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-11-19 10:23:41 +01:00
Dodji Seketeli
7fbe6a96ed Generate the manual html documentation in the proper build directory
* doc/manuals/Makefile.am: Renamed doc/manuals/Makefile into this.
	(BUILDDIR): Make this variable point to $(builddir)/_build as
	opposed to just _build previously.
	(SOURCEDIR): New variable that points to the source dir as known
	by the autotools magic.
	(ALLSPHINXOPTS): Make the source dir refer to the new
	$(SOURCEDIR), rather than just '.' as previously.
	* configure.ac (doc/manuals/Makefile): Generate this now.
	* doc/Makefile.am: Link the sub-directory doc/manuals.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-11-18 23:32:50 +01:00
Dodji Seketeli
1082520383 Make the use of a C++-11 compiler optional
* configure.ac: Define a new --enable-cxx11 switch to control the
	use of the C++-11 compiler.  Define a WITH_CXX11 C macro and an
	automake ENABLE_CXX11 variable.
	* config.h.in: Initialize the new WITH_CXX11 C macro.
	* src/Makefile.am: Include the files coded in C++-11 only if the
	ENABLE_CXX11 automake variable is defined.
	* tests/Makefile.am: Likewise, build the runtestsvg test program
	only if C++-11 usage is enabled.
	* include/abg-diff-utils.h (class d_path_vec): Remove useless
	usage of the 'typename' keyword.
	* include/abg-fwd.h (is_enum_type): Renamed is_enum into this,
	because of a name clash with a tr1 function when not using C++-11.
	(is_pointer_type): Likewise, renamed is_pointer into this because
	of a name clash with a tr1 function when not using C++-11.
	* src/abg-comp-filter.cc (has_harmless_name_change): Adjust for
	the is_enum -> is_enum_type change.
	* src/abg-comparison.cc (type_suppression::suppresses_diff):
	Likewise.
	(class function_suppression::priv): Add a missing "class" keyword
	in friend declaration.
	(diff_context::diff_has_been_traversed)
	(diff_context::mark_diff_as_traversed): Do not use the C++-11
	specific type uintptr_t.
	* src/abg-dwarf-reader.cc (create_default_dwfl): Do not use
	designated initializers.  Sigh.  This is handy though.
	(expr_result::abs): Cast the argument of std::abs to avoid
	ambiguous call.
	(finish_member_function_reading): Adjust for the is_pointer ->
	is_pointer_type renaming.
	* src/abg-hash.cc (scope_decl:#️⃣:operator)
	(class_decl::base_spec:#️⃣:operator)
	(type_composition:#️⃣:operator): Use std::tr1::hash string,
	rather than the C++-11 specific std::hash function.
	* src/abg-ini.cc (read_sections, write_sections): Make
	std::ifstream constructor take a const char* rather than a string.
	* src/abg-ir.cc (is_enum_type, is_pointer_type): Renamed is_enum
	into is_enum_type and is_pointer into is_pointer_type.
	* src/abg-writer.cc (write_translation_unit): Remove useless
	typename keyword.  Make ofstream take a const char* rather than a
	string.
	(write_namespace_decl): Remove useless typename keyword.
	(write_corpus_to_native_xml_file): Make ofstream take a const
	char* rather than a string.
	* tests/test-abidiff.cc (main): Make ofstream take a const char*
	rather than a string.
	* tests/test-diff-dwarf.cc (main): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-11-05 10:45:07 +01:00
Jan Engelhardt
f505d05b3c Add libelf to libabigail.la's linker line
* configure.ac: Check for the existence of libelf at configure
	time by looking at the presence of the elf_end symbol.  Add the
	libelf to the link command line.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:04:57 +02:00
Jan Engelhardt
1708e39fe7 Replace indirect variable assignments
* configure.ac(DEVEL_CFLAGS, DEVEL_CXXFLAGS):  Remove these
	useless variables.
	(CFLAGS, CXXFLAGS): Set these variables directly.
	* include/Makefile.am (pkginclude_HEADERS): Use this predefined
	variable.
	(publicheaders_DATA, publicheadersdir): Remove these.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:04:54 +02:00
Jan Engelhardt
e66eda9fe7 Remove empty and autogenerated files from git repository
* ChangeLog: Remove this empty file for now.  It'll be added back
	right before the first release by automatic generation from the
	commit logs.
	* INSTALL: Remove this empty file for now.
	* NEWS: Remove this empty file for now.  It'll be added back right
	before the first release.
	* configure.ac (AM_INIT_AUTOMAKE): As the mandatory but empty
	files above are being removed for now, let's put in the 'foreign'
	mode of automake for the moment.  We'll likely remove it at
	release time.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:04:48 +02:00
Jan Engelhardt
aa7fc67119 Set automake options globally
* configure.ac(AM_INIT_AUTOMAKE): Set the subdir-object option
	here ..
	* src/Makefile.am: ... not here.
	* tests/Makefile.am: Likewise.
	* tools/Makefile.am: Likewise.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:04:45 +02:00
Jan Engelhardt
0b1224faf1 Stash some autogenerated tools in build-aux/
* configure.ac: Reduce the pollution in the top-level directory a
	bit.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:04:42 +02:00
Dodji Seketeli
e6e7680113 Display package configuration at the end of configure
* configure.ac: Display the configure of the package at the end of
	the configure script.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-31 11:28:42 +02:00
Dodji Seketeli
36ed6e0583 Make zip archive support optional
* configure.ac: Support a new --enable-zip-archive option.  By
	default its value is set to the 'auto', meaning that if libzip is
	installed, that turns the option on -- just like if
	--enable-zip-archive was called with the value 'yes'; if libzip is
	not installed, that turns the option off -- just like if
	--enable-zip-archive was called with the value 'no'.  If libzip is
	detected, the pre-processor macro HAVE_LIBZIP is set to 1.  If
	--enable-zip-archive is turned on, the pre-processor macro
	WITH_ZIP_ARCHIVE is set to 1.
	* config.h.in (HAVE_LIBZIP, WITH_ZIP): New define.
	* src/abg-corpus.cc: Include config.h.  Guard the inclusion of
	abg-libzip-utils.h with the WITH_ZIP_ARCHIVE macro.  Likewise for
	the use of declarations coming from abg-libzip-utils.h.
	* src/abg-libzip-utils.cc: Include config.h.  Guard the file's
	content with the WITH_ZIP_ARCHIVE macro.
	* src/abg-reader.cc: Include config.h.  Guard the inclusion of
	abg-libzip-utils.h with the WITH_ZIP_ARCHIVE.  Likewise for the
	use of declarations coming from abg-libzip-utils.h.
	* src/abg-writer.cc: Likewise.
	* tests/Makefile.am: Build runtestwritereadarchive and runtestdot
	only if zip archives are supported.
	* tools/Makefile.am: The biar program is built only if
	zip archives are supported.
	* tools/bidiff.cc: Handle zip archives only if the
	WITH_ZIP_ARCHIVE macros is defined.
	* tools/bilint.cc: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-31 11:28:42 +02:00
Dodji Seketeli
bd1af4cd52 Initial support of reading an ABI Corpus from DWARF
* configure.ac: Check the presence of libdw.so and
	elfutils/libdwfl.h headers from elfutils and define the necessary
	linking flags.
	* include/abg-dwarf-reader.h: New header file
	* include/Makefile.am: Add the new header file to the source
	distribution.
	* src/abg-dwarf-reader.cc:: New file.
	* src/Makefile.am: Add the new file to the source distribution.
	* include/abg-fwd.h (dump): Add declarations for several overloads
	to allow dumping to a given output stream.
	* include/abg-ir.h (class translation_unit): Use a pimpl idiom for
	this now.
	(translation_unit::canonicalize_type): Declare new method.
	* src/abg-ir.cc (struct translation_unit::priv): New private type
	for the pimpl idiom for translation_unit.
	(translation_unit::{translation_unit, get_global_scope, get_path,
	set_path, get_loc_mgr}): Adjust for pimpl idiom.
	(translation_unit::canonicalize_type): Define this new method and
	one overload.
	* src/abg-writer.cc (dump): Define several overloads to dump IR
	nodes to given output streams.
	* tools/bidw.cc: New file for the new bidw tool.
	* tools/Makefile.am: Define rules to build the new bidw tools.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-12-07 08:07:54 +01:00
Dodji Seketeli
0d738e2b95 Initial version of an archive manipulation program: biar
* tests/test-utils.h (is_dir, ensure_dir_path_created)
	(ensure_parent_dir_created): Move these directories manipulation
	utilities from here to ...
	* tools/abg-tools-utils.h (is_dir, ensure_dir_path_created)
	(ensure_parent_dir_created): ... here in this new file.
	(dir_name, base_name): Declare these new functions.
	* tests/test-utils.cc (is_dir, ensure_dir_path_created)
	(ensure_parent_dir_created): Likewise, move these to ...
	* tools/abg-tools-utils.cc (is_dir, ensure_dir_path_created)
	(ensure_parent_dir_created): ... here in this new file.
	(dir_name, base_name): Define these.
	* tools/Makefile.am: New file.  Create a new libtoolsutils.la
	static library with stuff from tools/abg-tools-utils.cc in it.
	Also create a new 'biar' program with the stuff from the new
	tools/biar.cc in it.
	* tools/biar.cc: New file.  Contains the code for the new "biar"
	archive manipulation command line utility.
	* tests/test-read-write.cc (main): Adjust for the change about
	ensure_parent_dir_created above.
	* tests/test-write-read-archive.cc (main): Likewise.
	* Makefile.am (SUBDIRS): Add the new tools/ sub-directory to the
	build system.
	* configure.ac (AC_CONFIG_FILES): Generate tools/Makefile.
	* tests/Makefile.am: Make libtestutils.la link with the new
	libtoolsutils.la.  Make sure to express the dependencies between
	libtestutils.la and the binaries that depend on it.  Otherwise
	parallel builds can go awry.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-08-29 17:08:47 +02:00
Dodji Seketeli
c57e950ec7 Initial writing/reading of an ABI corpus to an archive
* configure.ac: Support detection of libzip dependency. Define
        new DEPS_CFLAGS and DEPS_LIBS variables for use in
        Makefile.am to refer to the dependency headers and
        libraries.
	* doc/website/mainpage.txt: Update this to talk about the new
	libzip dependency.
	* include/Makefile.am: Add abg-libzip-utils.h to the build system.
	* include/abg-corpus.h (corps): Hide abigail::corpus's private behind a
	pimpl idiom.
	(corpus::{drop_translation_units, get_file_path, set_file_path,
	write, read}): New methods.
	* include/abg-libxml-utils.h (new_reader_from_buffer): Declare new
	function.
	* include/abg-libzip-utils.h: New file.
	* src/Makefile.am: Add abg-corpus.cc and abg-libzip-utils.cc to
	the build system.  Refer to the library and headers dependencies
	via the new DEPS_LIBS and DEPS_CFLAGS variables.
	* src/abg-corpus.cc: New file.
	* src/abg-ir.cc (translation::set_path): New method.
	* src/abg-libxml-utils.cc (new_reader_from_buffer): Define new
	function.
	* src/abg-libzip-utils.cc: New file.
	* src/abg-reader.cc (translation_unit::read): New overload.
	* src/abg-writer.cc: Inject the names from the std namespace into
	the abigail namespace, rather than into abigail::writer.
	(abigail::translation_unit::write): New overload.  This can now
	use ofstream and the other stuff from std that are injected in the
	abigail:: namespace.
	* tests/Makefile.am: Add tests/test-write-read-archive.cc to the
	build system; use that to build runtestwritereadarchive.  Also add
	the input test data from
	tests/data/test-write-read-archive/test[0-4].xml.
	* /tests/data/test-write-read-archive/test[0-4].xml: New test
	input data files.
	* tests/test-write-read-archive.cc: New test for this archive
	write/read support.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-08-27 16:20:41 +02:00
Dodji Seketeli
fb481b3693 Add abg-version.h.in to the source distribution & cleanup
* include/Makefile.am:  Add abg-version.h.in to the source
	distribution.
	* configure.ac: Generate abg-version.h in using the existing
	AC_CONFIG_FILES macro call.
2013-08-22 17:07:07 +02:00
Dodji Seketeli
849b598cf5 Support pkgconfig through a new libabigail.pc file
* libabigail.pc.in: New pkgconfig file.
	* configure.ac: Define the LIBXML2_VERSION variable that is used
	in the libabigail.pc.in file.  Generate the libabigail.pc file
	from its libabigail.pc.in template.
	* Makefile.am: Add libabigail.pc.in to the source distribution.
	Install the generated libabigail.pc to the right destination.
2013-08-22 17:06:56 +02:00
Benjamin Kosnik
d23c4e9b96 Collapse subdir of include to include.
* include/libabigail/abg-*.h: Move to...
	* include/abg-*.h
	* include/libabigail: Remove.

	* configure.ac: Adjust include location from libabigail/include to
	include.
	* Makefile.in: Same.
	* aclocal.m4: Same.
	* configure: Same.
	* doc/Makefile.in: Same.
	* include/Makefile.am: Same.
	* src/Makefile.am: Same.
	* src/Makefile.in: Same.
	* tests/Makefile.am: Same.
	* tests/Makefile.in: Same.
2013-08-14 15:07:18 +02:00
Dodji Seketeli
f9d66af03c Put headers in include/libabigail
* include/libabigail: New directory.
	* include/Makefile.am:  New file.
	* include/libabigail/Makefile.am: New file.
	* src/abg-*.h: Move these in include/libabigail/*.h
	* src/Makefile.am: Set -I option to look for headers in include/libabigail
	* doc/api/libabigail.doxy: Look for headers in include/libabigail
	* tests/Makefile.am: Set -I option to look for headers in include/libabigail
	* abigail.m4: Set includedir to $prefix/include/libabigail for
	library used as a dep, or to srcdir/libabigail/include/libabigail
	in GCC source tree.
	* configure.ac: Add Makefile.am in include and include/libabigail
	* abigail.m4: Look for headers in include/libabigail when the
	libabigail is in in the source tree and in $incdir/libabigail when
	it is installed as a dependency.
2013-07-23 23:13:56 +02:00
Benjamin Kosnik
6fb9db6505 Fixup abg-version.h merge duplicate.
2013-05-21  Benjamin Kosnik  <bkoz@redhat.com>

	* configure.ac: Remove src/abg-version.h merge duplicate.
2013-07-23 23:13:54 +02:00
Benjamin Kosnik
73dec4acda Generate abg-version.h at configure time.
2013-05-20  Benjamin Kosnik  <bkoz@redhat.com>

	* configure.ac: Add src/abg-version.h to AC_CONFIG_FILES.
	* src/Makefile.am: Remove abg-version.h generation rules.
	* src/abg-version.h.in: New.
2013-07-23 23:13:54 +02:00
Benjamin Kosnik
cdf03dd644 Generate abg-version at configure time in builddir
* configure.ac: Add src/abg-version.h to AC_CONFIG_FILES.
	* src/Makefile.am: Remote ad-hoc generation of abg-version.h from
	here.
	* src/abg-version.h.in: New file.
	* configure: Re-generate.
	* src/Makefile.in: Likewise.
2013-07-23 23:13:52 +02:00
Dodji Seketeli
e4fefbdbe4 Allow autoconf-based clients to detect the library
* configure.ac: Define the components of the version number as
	autoconf variables.  Set the version number to 0.1.0
	* abigail.m4: New file
	* Makefile.am: Add abigail.m4 to the build system.  Install it in
	  $(datadir)/aclocal.
	* src/Makefile.am: Generate and add abg-version.h from the version
	number autoconf variable defined in configure.ac.  Re-generate
	abg-version.h each time configure.ac changes.
	* src/abg-config.h (abigail_get_library_version): Declare ...
	* src/abg-config.cc (abigail_get_library_version): ... and define
	this wirth C linkage.  This is useful for autoconf tests to test
	for the presence of the library.
	* configure: Re-generate.
	* Makefile.in: Likewise.
	* src/Makefile.in: Likewise.
	* tests/Makefile.in: Likewise.
2013-07-23 23:13:51 +02:00
Benjamin Kosnik
43a83cf453 Add doc dir. Add Doxgen api generation rules.
2013-04-02  Benjamin Kosnik  <bkoz@redhat.com>

	* doc: Add.
	* doc/Makefile.am (html, install-html): Add.
	* doc/Makefile.in: Add.
	* doc/api/libabigail.doxy: Add doxygen config.
	* src/abg-*: Add @file markup.
2013-04-03 15:21:33 +02:00
Benjamin Kosnik
342b932d54 Various autotool adjustments
* configure: Add.
	* configure.ac (AM_INIT_AUTOMAKE): Use gcc versions.
        (PKG_CHECK_MODULES): Re-use libjava/classpath solution, naming.
	* m4/pkg.m4: Add, take from classpath.
	* src/Makefile.am: Adjust names.
2013-03-27 21:01:54 +01:00
Dodji Seketeli
fc27d10cee Debugged type-decl de-serialization
* src/abg-ir.cc (namespace_decl::~namespace_decl): Add this
	missing virtual constructor definition.
	* src/abg-reader.cc (read_context::{get_cur_decl,pop_decl}):
	Return a null pointer when the decls stack is empty.
	(update_read_context): Don't try to de-reference a NULL cur_decl.
	(read_input): Don't try to poke at file validity here.  What was I
	thinking.  Really test for advance_cursor to return 1, expressing
	success.
	* src/abg-reader.h (read_file):  Fix style.
	* Makefile.am: Add tests sub-directory.
	* configure.ac: Build with debugging-friendly options if the
	ABIGAIL_DEBUG env variable is set.  Generate tests/Makefile.
	* tests/Makefile.am: New file.
	* tests/test-read-write.cc: Likewise.
	* tests/test-utils.{h,cc}: Likewise.
	* tests/data/test-read-write/input0.xml: Likewise.
2013-03-21 23:57:22 +01:00
Dodji Seketeli
8e225db39a Parse type-decl and namespace-decl elements
* configure.ac: Add libxml2 dependencies.
	* src/abg-corpus.{h,cc}: New files.
	* src/abg-hash.{h,cc}: Likewise.
	* src/abg-libxml-utils.{h,cc}: Likewise.
	* src/abg-reader.{h,cc}: Likewise.
	* src/abg-serialize.{h,cc}: Likewise.
	* src/abg-writer.h: Likewise.
	* src/Makefile.am: Build the new files above.
	* src/abg-ir.h (class location): Add public accessors for the value, and
	a truth operator.  Make the methods be inline.
	(class decl_base): Renamed decl into this.  Renamed what_decl_kind
	into what_kind. Renamed get_context into get_scope.  Add virtual
	destructor, accessors for location and name.
	(class {scope_decl, type_base, type_decl} ): Add virtual dtor.
	Re-style.
	(struct {decl_base_hash, type_decl_hash}): New hashing functors.
	(class {scope_type_decl, namespace_decl}): Add virtual dtor.
	* src/abg-ir.cc (location::*): Remove location definitions.  There
	are now inline in the header.
	(class decl_base): Renamed decl into this.  Remove most of the
	definitions from here as their are now inline in the header.
	(scope_decl::~scope_decl, type_base::~type_base)
	(type_decl::~type_decl, scope_type_decl::~scope_type_decl): New
	definitions.
2013-03-08 14:31:37 +01:00
Dodji Seketeli
d7d371a742 Initial import Abigail
This is the initial Import of the

    ABI Generic Analysis and Instrumentation Library
2013-02-28 11:42:57 +01:00