From 311e9a6d7dee5c778626eaf06dad7ff216c82e2d Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 14 Jun 2016 12:43:05 +0200 Subject: [PATCH] Fixed autotools build --- configure.ac | 18 ++++++++++++++++++ src/Makefile.am | 2 ++ src/grammarbuilder.cc | 2 +- tools/Makefile.am | 4 ++-- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 208308f..fda666d 100644 --- a/configure.ac +++ b/configure.ac @@ -17,6 +17,24 @@ CXXFLAGS="$CXXFLAGS -std=c++11 -Wall -Werror" # Checks for libraries. +dnl ################################################## +dnl # Check for BcToolbox +dnl ################################################## + +dnl check bctoolbox +PKG_CHECK_MODULES(BCTOOLBOX, [bctoolbox],[libbctoolbox_found=yes],foo=bar) +if test "$libbctoolbox_found" != "yes" ; then + dnl Check the lib presence in case the PKG-CONFIG version is not found + AC_LANG_CPLUSPLUS + AC_CHECK_LIB(bctoolbox, main, [BCTOOLBOX_LIBS+=" -lbctoolbox"; libbctoolbox_found=yes], [foo=bar]) + AC_LANG_C +fi +if test "$libbctoolbox_found" != "yes" ; then + AC_MSG_ERROR([libbctoolbox not found. Install it and try again]) +fi + +AC_SUBST(BCTOOLBOX_LIBS) + # Checks for header files. # Checks for typedefs, structures, and compiler characteristics. diff --git a/src/Makefile.am b/src/Makefile.am index 50435a5..8ccec8d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,3 +8,5 @@ libbelr_la_SOURCES=belr.cc belr.hh \ AM_CPPFLAGS=-I$(top_srcdir)/include +libbelr_la_LIBADD=$(BCTOOLBOX_LIBS) + diff --git a/src/grammarbuilder.cc b/src/grammarbuilder.cc index e297ff2..a56a533 100644 --- a/src/grammarbuilder.cc +++ b/src/grammarbuilder.cc @@ -326,7 +326,7 @@ shared_ptr ABNFGrammarBuilder::createFromAbnf(const string &abnf, const shared_ptr builder = mParser.parseInput("rulelist",abnf,&parsed); if (parsed<(size_t)abnf.size()){ - bctbx_error("[belr] Only %i bytes parsed over a total of %i.", parsed, abnf.size()); + bctbx_error("[belr] Only %llu bytes parsed over a total of %llu.", (unsigned long long)parsed, (unsigned long long) abnf.size()); return NULL; } shared_ptr retGram; diff --git a/tools/Makefile.am b/tools/Makefile.am index 9522578..53e0527 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -3,10 +3,10 @@ noinst_PROGRAMS=belr-demo belr_parse_SOURCES=belr-parse.cc -belr_parse_LDADD=$(top_builddir)/src/libbelr.la +belr_parse_LDADD=$(top_builddir)/src/libbelr.la $(BCTOOLBOX_LIBS) belr_demo_SOURCES=belr-demo.cc -belr_demo_LDADD=$(top_builddir)/src/libbelr.la +belr_demo_LDADD=$(top_builddir)/src/libbelr.la $(BCTOOLBOX_LIBS) AM_CPPFLAGS=-I$(top_srcdir)/include -- 2.21.0