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.
This commit is contained in:
Dodji Seketeli 2013-05-07 12:42:53 +02:00 committed by Dodji Seketeli
parent 3563b06270
commit e4fefbdbe4
11 changed files with 318 additions and 37 deletions

View File

@ -2,6 +2,9 @@ SUBDIRS = src tests doc
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
headers = config.h
m4datadir = $(datadir)/aclocal
m4data_DATA = abigail.m4
EXTRA_DIST = \
README INSTALL COPYING \
$(headers)

View File

@ -13,6 +13,7 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__make_dryrun = \
{ \
@ -93,6 +94,35 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(m4datadir)"
DATA = $(m4data_DATA)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
@ -212,6 +242,9 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
VERSION_MAJOR = @VERSION_MAJOR@
VERSION_MINOR = @VERSION_MINOR@
VERSION_REVISION = @VERSION_REVISION@
XML_CFLAGS = @XML_CFLAGS@
XML_LIBS = @XML_LIBS@
abs_builddir = @abs_builddir@
@ -270,6 +303,8 @@ top_srcdir = @top_srcdir@
SUBDIRS = src tests doc
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
headers = config.h
m4datadir = $(datadir)/aclocal
m4data_DATA = abigail.m4
EXTRA_DIST = \
README INSTALL COPYING \
$(headers)
@ -336,6 +371,27 @@ clean-libtool:
distclean-libtool:
-rm -f libtool config.lt
install-m4dataDATA: $(m4data_DATA)
@$(NORMAL_INSTALL)
@list='$(m4data_DATA)'; test -n "$(m4datadir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(m4datadir)'"; \
$(MKDIR_P) "$(DESTDIR)$(m4datadir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(m4datadir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(m4datadir)" || exit $$?; \
done
uninstall-m4dataDATA:
@$(NORMAL_UNINSTALL)
@list='$(m4data_DATA)'; test -n "$(m4datadir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(m4datadir)'; $(am__uninstall_files_from_dir)
# This directory's subdirectories are mostly independent; you can cd
# into them and run 'make' without going through this Makefile.
@ -656,9 +712,12 @@ distcleancheck: distclean
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile config.h
all-am: Makefile $(DATA) config.h
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(m4datadir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
@ -711,7 +770,7 @@ info: info-recursive
info-am:
install-data-am:
install-data-am: install-m4dataDATA
install-dvi: install-dvi-recursive
@ -757,7 +816,7 @@ ps: ps-recursive
ps-am:
uninstall-am:
uninstall-am: uninstall-m4dataDATA
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
cscopelist-recursive ctags-recursive install-am install-strip \
@ -773,12 +832,13 @@ uninstall-am:
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags tags-recursive uninstall uninstall-am
install-html-am install-info install-info-am \
install-m4dataDATA install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am uninstall-m4dataDATA
# Tell versions [3.59,3.63) of GNU make to not export all variables.

134
abigail.m4 Normal file
View File

@ -0,0 +1,134 @@
# ABIGAIL_INIT
#
# Handle the detection of the libabigail header and library files on
# the system. If these are present, set the 'abigailinc' variable to
# the compiler option necessary to locate the headers of the library;
# also set the 'abigaillibs' variable to the compiler/linker option
# necessary to locate the library.
#
# Note that this macro defines the handling of --with-abigail,
# --with-abigail-include, --with-abigail-lib and
# --enable-abigail-version-check switches to the configure script.
AC_DEFUN([ABIGAIL_INIT],
[
AC_ARG_WITH([abigail],
[AS_HELP_STRING([--with-abigail],
[Prefix directory for abigail library])],
[],
[])
AC_ARG_WITH([abigail-include],
[AS_HELP_STRING([--with-abigail-include],
[Directory for installed abigail include files])],
[],
[])
AC_ARG_WITH([abigail-lib],
[AS_HELP_STRING([--with-abigail-lib],
[Directory for installed abigail library])],
[],
[])
AC_ARG_ENABLE(abigail-version-check,
[AS_HELP_STRING([--enable-abigail-version-check],
[Enable check for libabigail version])],
[ENABLE_ABIGAIL_VERSION_CHECK=$enableval],
[ENABLE_ABIGAIL_VERSION_CHECK=yes])
if test x$with_abigail != x -a x$with_abigail != xno; then
abigailinc="-I$with_abigail/include"
abigaillibs="-L$with_abigail/lib"
found_abigail_lib=yes
found_abigail_inc=yes
fi
if test x$with_abigail_include != x -a x$with_abigail != xno; then
abigailinc="-I$with_abigail_include"
found_abigail_inc=yes
fi
if test x$with_abigail_lib != x -a x$with_abigail != xno; then
abigaillibs="-L$with_abigail_lib"
found_abigail_lib=yes
fi
if test x$abigaillibs = x; then
AC_CHECK_LIB(abigail, abigail_get_library_version,
[found_abigail_lib=yes], [], [])
fi
if test x$found_abigail_lib = xyes; then
abigaillibs="$abigaillibs -labigail"
fi
if test x$abigailinc = x; then
AC_LANG_PUSH(C++)
AC_CHECK_HEADER([libabigail/abg-version.h],
[found_abigail_inc=yes], [], [])
AC_LANG_POP(C++)
fi
if test x$found_abigail_lib = xyes -a x$found_abigail_inc = xyes; then
HAVE_LIBABIGAIL=yes
else
HAVE_LIBABIGAIL=no
fi
]
)
# IF_ABIGAIL_PRESENT(ACTION-IF-PRESENT)
AC_DEFUN([IF_ABIGAIL_PRESENT],
[
AC_REQUIRE([ABIGAIL_INIT])
if test x$HAVE_LIBABIGAIL = xyes; then
$1
fi
]
)
# IF_ABIGAIL_NOT_PRESENT(ACTION-IF-NOT-PRESENT)
AC_DEFUN([IF_ABIGAIL_NOT_PRESENT],
[
AC_REQUIRE([ABIGAIL_INIT])
if test x$HAVE_LIBABIGAIL != xyes; then
$1
fi
]
)
# ABIGAIL_CHECK_VERSION(MAJOR, MINOR)
#
# Test the whether the found major and minor version numbers of the
# found abigail library is compatible with the MAJOR.MINOR version
# number given in argument. The result of the test ('yes' or 'no') is
# put in the variable has_right_abigail_version.
AC_DEFUN([ABIGAIL_CHECK_VERSION],
[
AC_REQUIRE([ABIGAIL_INIT])
if test x$ENABLE_ABIGAIL_VERSION_CHECK = xyes; then
_abigail_saved_CXXFLAGS=$CXXFLAGLS
_abigail_saved_LDFLAGS=$LDFLAGS
CXXFLAGS="$abigailinc"
LDFLAGS="$abigaillibs"
AC_MSG_CHECKING([for version $1.$2 of libabigail])
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include "libabigail/abg-version.h"],
[#if ABIGAIL_VERSION_MAJOR != $1 || ABIGAIL_VERSION_MINOR < $2
choke here
#endif
])
],
has_right_abigail_version=yes,
has_right_abigail_version=no)
AC_LANG_POP(C++)
AC_MSG_RESULT([$has_right_abigail_version])
CXXFLAGS=$_abigail_saved_CXXFLAGS
LDFLAGS=$_abigail_saved_LDFLAGS
fi
]
)

31
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for libabigail 0.1.
# Generated by GNU Autoconf 2.69 for libabigail 0.1.0.
#
# Report bugs to <http://sourceware.org/bugzilla>.
#
@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libabigail'
PACKAGE_TARNAME='libabigail'
PACKAGE_VERSION='0.1'
PACKAGE_STRING='libabigail 0.1'
PACKAGE_VERSION='0.1.0'
PACKAGE_STRING='libabigail 0.1.0'
PACKAGE_BUGREPORT='http://sourceware.org/bugzilla'
PACKAGE_URL='http://sourceware.org/libabigail'
@ -693,6 +693,9 @@ CPPFLAGS
LDFLAGS
CXXFLAGS
CXX
VERSION_REVISION
VERSION_MINOR
VERSION_MAJOR
AM_BACKSLASH
AM_DEFAULT_VERBOSITY
AM_DEFAULT_V
@ -1328,7 +1331,7 @@ 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 libabigail 0.1 to adapt to many kinds of systems.
\`configure' configures libabigail 0.1.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1398,7 +1401,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of libabigail 0.1:";;
short | recursive ) echo "Configuration of libabigail 0.1.0:";;
esac
cat <<\_ACEOF
@ -1510,7 +1513,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
libabigail configure 0.1
libabigail configure 0.1.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -2000,7 +2003,7 @@ 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 libabigail $as_me 0.1, which was
It was created by libabigail $as_me 0.1.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -2831,7 +2834,7 @@ fi
# Define the identity of the package.
PACKAGE='libabigail'
VERSION='0.1'
VERSION='0.1.0'
cat >>confdefs.h <<_ACEOF
@ -2941,6 +2944,14 @@ fi
AM_BACKSLASH='\'
VERSION_MAJOR=0
VERSION_MINOR=1
VERSION_REVISION=0
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
@ -15818,7 +15829,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by libabigail $as_me 0.1, which was
This file was extended by libabigail $as_me 0.1.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -15885,7 +15896,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
libabigail config.status 0.1
libabigail config.status 0.1.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@ -1,5 +1,9 @@
m4_define([version_major], [0])
m4_define([version_minor], [1])
m4_define([version_revision],[0])
AC_INIT([libabigail],
[0.1],
[version_major.version_minor.version_revision],
[http://sourceware.org/bugzilla],
[libabigail],
[http://sourceware.org/libabigail])
@ -14,6 +18,14 @@ AM_MAINTAINER_MODE([enable])
AM_SILENT_RULES([yes])
VERSION_MAJOR=version_major
VERSION_MINOR=version_minor
VERSION_REVISION=version_revision
AC_SUBST(VERSION_MAJOR)
AC_SUBST(VERSION_MINOR)
AC_SUBST(VERSION_REVISION)
dnl *************************************************
dnl Here is the list of versions of the dependencies
dnl *************************************************

View File

@ -150,6 +150,9 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
VERSION_MAJOR = @VERSION_MAJOR@
VERSION_MINOR = @VERSION_MINOR@
VERSION_REVISION = @VERSION_REVISION@
XML_CFLAGS = @XML_CFLAGS@
XML_LIBS = @XML_LIBS@
abs_builddir = @abs_builddir@

View File

@ -1,16 +1,15 @@
libabigail_LTLIBRARIES=libabigail.la
libabigaildir=$(libdir)/
h=$(abs_srcdir)
headers = \
abg-ir.h \
abg-reader.h \
abg-corpus.h \
abg-reader.h \
abg-corpus.h \
abg-libxml-utils.h \
abg-hash.h \
abg-writer.h \
abg-config.h
abg-writer.h \
abg-config.h \
abg-version.h
libabigail_la_SOURCES = $(headers) \
abg-ir.cc \
@ -21,6 +20,19 @@ abg-hash.cc \
abg-writer.cc \
abg-config.cc
all-local: $(srcdir)/abg-version.h
$(srcdir)/abg-version.h: $(top_srcdir)/configure.ac
@echo "Generating $(srcdir)/abg-version.h ..."
@echo "#ifndef __ABG_VERSION_H__" > $(srcdir)/abg-version.h
@echo "#define __ABG_VERSION_H__" >> $(srcdir)/abg-version.h
@echo "#define ABIGAIL_VERSION_MAJOR @VERSION_MAJOR@" >> $(srcdir)/abg-version.h
@echo "#define ABIGAIL_VERSION_MINOR @VERSION_MINOR@" >> $(srcdir)/abg-version.h
@echo "#define ABIGAIL_VERSION_REVISION @VERSION_REVISION@" >> $(srcdir)/abg-version.h
@echo "#endif" >> $(srcdir)/abg-version.h
@echo "Done."
libabigail_la_LDFLAGS=@XML_LIBS@ -Wl,--as-needed
publicheaders_DATA=$(headers)

View File

@ -240,6 +240,9 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
VERSION_MAJOR = @VERSION_MAJOR@
VERSION_MINOR = @VERSION_MINOR@
VERSION_REVISION = @VERSION_REVISION@
XML_CFLAGS = @XML_CFLAGS@
XML_LIBS = @XML_LIBS@
abs_builddir = @abs_builddir@
@ -297,15 +300,15 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
libabigail_LTLIBRARIES = libabigail.la
libabigaildir = $(libdir)/
h = $(abs_srcdir)
headers = \
abg-ir.h \
abg-reader.h \
abg-corpus.h \
abg-reader.h \
abg-corpus.h \
abg-libxml-utils.h \
abg-hash.h \
abg-writer.h \
abg-config.h
abg-writer.h \
abg-config.h \
abg-version.h
libabigail_la_SOURCES = $(headers) \
abg-ir.cc \
@ -551,7 +554,7 @@ distdir: $(DISTFILES)
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(DATA)
all-am: Makefile $(LTLIBRARIES) $(DATA) all-local
installdirs:
for dir in "$(DESTDIR)$(libabigaildir)" "$(DESTDIR)$(publicheadersdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
@ -661,9 +664,9 @@ uninstall-am: uninstall-libabigailLTLIBRARIES \
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libabigailLTLIBRARIES clean-libtool cscopelist ctags \
distclean distclean-compile distclean-generic \
.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \
clean-generic clean-libabigailLTLIBRARIES clean-libtool \
cscopelist ctags distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
@ -678,6 +681,18 @@ uninstall-am: uninstall-libabigailLTLIBRARIES \
uninstall-publicheadersDATA
all-local: $(srcdir)/abg-version.h
$(srcdir)/abg-version.h: $(top_srcdir)/configure.ac
@echo "Generating $(srcdir)/abg-version.h ..."
@echo "#ifndef __ABG_VERSION_H__" > $(srcdir)/abg-version.h
@echo "#define __ABG_VERSION_H__" >> $(srcdir)/abg-version.h
@echo "#define ABIGAIL_VERSION_MAJOR @VERSION_MAJOR@" >> $(srcdir)/abg-version.h
@echo "#define ABIGAIL_VERSION_MINOR @VERSION_MINOR@" >> $(srcdir)/abg-version.h
@echo "#define ABIGAIL_VERSION_REVISION @VERSION_REVISION@" >> $(srcdir)/abg-version.h
@echo "#endif" >> $(srcdir)/abg-version.h
@echo "Done."
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,3 +1,4 @@
// -*- Mode: C++ -*-
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU Application Binary Interface Generic
@ -21,10 +22,11 @@
// program; see the files COPYING3 and COPYING.RUNTIME respectively.
// If not, see <http://www.gnu.org/licenses/>.
// -*- Mode: C++ -*-
/// @file
#include "abg-config.h"
#include "abg-version.h"
namespace abigail
{
@ -73,3 +75,23 @@ config::set_xml_element_indent(unsigned indent)
}
}//end namespace abigail
extern "C"
{
/// Return the relevant version numbers of the library.
///
/// \param major the majar version number of the library.
///
/// \param minor the minor version number of the library.
///
/// \param revision the revision version number of the library.
void
abigail_get_library_version(int& major, int& minor, int& revision)
{
major = ABIGAIL_VERSION_MAJOR;
minor = ABIGAIL_VERSION_MINOR;
revision = ABIGAIL_VERSION_REVISION;
}
}

View File

@ -1,3 +1,5 @@
// -*- Mode: C++ -*-
// Copyright (C) 2013 Free Software Foundation, Inc.
//
// This file is part of the GNU Application Binary Interface Generic
@ -21,7 +23,6 @@
// program; see the files COPYING3 and COPYING.RUNTIME respectively.
// If not, see <http://www.gnu.org/licenses/>.
// -*- Mode: C++ -*-
/// @file
#ifndef __ABG_CONFIG_H__
@ -63,4 +64,9 @@ private:
}//end namespace abigail
extern "C"
{
void
abigail_get_library_version(int& major, int& minor, int& revision);
}
#endif //__ABG_CONFIG_H__

View File

@ -219,6 +219,9 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
VERSION_MAJOR = @VERSION_MAJOR@
VERSION_MINOR = @VERSION_MINOR@
VERSION_REVISION = @VERSION_REVISION@
XML_CFLAGS = @XML_CFLAGS@
XML_LIBS = @XML_LIBS@
abs_builddir = @abs_builddir@