1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3 4AC_PREREQ([2.63]) 5AC_INIT([belcard], [1.0.1], [sylvain.berfini@belledonne-communications.com]) 6 7BELCARD_SO_CURRENT=0 dnl increment this number when you add/change/remove an interface 8BELCARD_SO_REVISION=0 dnl increment this number when you change source code, without changing interfaces; set to 0 when incrementing CURRENT 9BELCARD_SO_AGE=1 dnl increment this number when you add an interface, set to 0 if you remove an interface 10 11BELCARD_SO_VERSION=$BELCARD_SO_CURRENT:$BELCARD_SO_REVISION:$BELCARD_SO_AGE 12 13AC_SUBST(BELCARD_SO_CURRENT, $BELCARD_SO_CURRENT) 14AC_SUBST(BELCARD_SO_VERSION) 15 16AC_CONFIG_SRCDIR([src/]) 17 18AC_CONFIG_MACRO_DIR([m4]) 19 20AC_CONFIG_HEADERS([config.h]) 21 22AC_CANONICAL_SYSTEM 23 24LT_INIT([shared disable-static]) 25 26dnl initialize pkg-config so that we can use it within if else fi statements. 27PKG_PROG_PKG_CONFIG() 28 29AM_INIT_AUTOMAKE(subdir-objects foreign) 30AM_SILENT_RULES(yes) 31 32# Checks for programs. 33AC_PROG_CXX 34 35CXXFLAGS="$CXXFLAGS -std=c++11 -Wall -Werror -Wextra -Wno-unused-parameter" 36 37# Checks for libraries. 38dnl ################################################## 39dnl # Check for XXD 40dnl ################################################## 41 42AC_CHECK_PROG(xxd_found, xxd, yes) 43if test "$xxd_found" != yes ;then 44 AC_MSG_ERROR("xxd is required (provided by vim package)") 45fi 46 47dnl ################################################## 48dnl # Check for BcToolbox 49dnl ################################################## 50 51dnl check bctoolbox 52PKG_CHECK_MODULES(BCTOOLBOX, [bctoolbox],[libbctoolbox_found=yes],foo=bar) 53if test "$libbctoolbox_found" != "yes" ; then 54 dnl Check the lib presence in case the PKG-CONFIG version is not found 55 AC_LANG_CPLUSPLUS 56 AC_CHECK_LIB(bctoolbox, main, [BCTOOLBOX_LIBS+=" -lbctoolbox"; libbctoolbox_found=yes], [foo=bar]) 57 AC_LANG_C 58fi 59if test "$libbctoolbox_found" != "yes" ; then 60 AC_MSG_ERROR([libbctoolbox not found. Install it and try again]) 61fi 62 63AC_SUBST(BCTOOLBOX_LIBS) 64 65dnl check bctoolbox-tester 66PKG_CHECK_MODULES(BCTOOLBOXTESTER, [bctoolbox-tester],[libbctoolbox_tester_found=yes],foo=bar) 67if test "$libbctoolbox_tester_found" != "yes" ; then 68 dnl Check the lib presence in case the PKG-CONFIG version is not found 69 AC_LANG_CPLUSPLUS 70 AC_CHECK_LIB(bctoolbox-tester, main, [BCTOOLBOXTESTER_LIBS+=" -lbctoolbox-tester"; libbctoolbox_tester_found=yes], [foo=bar]) 71 AC_LANG_C 72fi 73if test "$libbctoolbox_tester_found" != "yes" ; then 74 AC_MSG_ERROR([libbctoolbox tester not found. Install it and try again]) 75fi 76 77AC_SUBST(BCTOOLBOXTESTER_LIBS) 78 79dnl ################################################## 80dnl # Check for Belr 81dnl ################################################## 82 83dnl check belr 84PKG_CHECK_MODULES(BELR, [belr],[libbelr_found=yes],foo=bar) 85if test "$libbelr_found" != "yes" ; then 86 dnl Check the lib presence in case the PKG-CONFIG version is not found 87 AC_LANG_CPLUSPLUS 88 AC_CHECK_LIB(belr, main, [BELR_LIBS+=" -lbelr"; libbelr_found=yes], [foo=bar]) 89 AC_LANG_C 90fi 91if test "$libbelr_found" != "yes" ; then 92 AC_MSG_ERROR([libbelr not found. Install it and try again]) 93fi 94 95AC_SUBST(BELR_CFLAGS) 96AC_SUBST(BELR_LIBS) 97 98dnl ################################################## 99dnl # Check for BCUnit 100dnl ################################################## 101 102PKG_CHECK_MODULES(BCUNIT, bcunit, [found_bcunit=yes],[found_bcunit=no]) 103 104if test "$found_bcunit" = "no" ; then 105 AC_CHECK_HEADERS(BCUnit/BCUnit.h, 106 [ 107 AC_CHECK_LIB(bcunit,CU_add_suite,[ 108 found_bcunit=yes 109 BCUNIT_LIBS+=" -lbcunit" 110 ]) 111 ]) 112fi 113case "$target_os" in 114 *darwin*) 115 #hack for macport 116 BCUNIT_LIBS+=" -lncurses" 117 ;; 118 *mingw*) 119 CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0501" 120 LIBS="$LIBS -lws2_32 -liphlpapi" 121 LDFLAGS="$LDFLAGS -Wl,--export-all-symbols" 122 ;; 123esac 124 125if test "$found_bcunit" = "no" ; then 126 AC_MSG_WARN([Could not find bcunit framework, tests are not compiled.]) 127else 128 AC_CHECK_LIB(bcunit,CU_get_suite,[ 129 AC_DEFINE(HAVE_CU_GET_SUITE,1,[defined when CU_get_suite is available]) 130 ],[foo=bar],[$BCUNIT_LIBS]) 131 AC_CHECK_LIB(bcunit,CU_curses_run_tests,[ 132 AC_DEFINE(HAVE_CU_CURSES,1,[defined when CU_curses_run_tests is available]) 133 ],[foo=bar],[$BCUNIT_LIBS]) 134fi 135 136AM_CONDITIONAL(BUILD_TESTS,test x$found_bcunit = xyes) 137 138# Checks for header files. 139 140# Checks for typedefs, structures, and compiler characteristics. 141AC_TYPE_SSIZE_T 142 143dnl substitute variables used by .pc files 144if test "$prefix" = "NONE" ; then 145 install_prefix=/usr 146else 147 install_prefix=$prefix 148fi 149 150PROJECT_VERSION=$VERSION 151CMAKE_INSTALL_PREFIX=$install_prefix 152CMAKE_INSTALL_FULL_LIBDIR=${libdir} 153CMAKE_INSTALL_FULL_INCLUDEDIR=${install_prefix}/include 154 155AC_SUBST(PROJECT_VERSION) 156AC_SUBST(CMAKE_INSTALL_PREFIX) 157AC_SUBST(CMAKE_INSTALL_FULL_LIBDIR) 158AC_SUBST(CMAKE_INSTALL_FULL_INCLUDEDIR) 159AC_SUBST(TESTER_REQUIRES_PRIVATE) 160 161# Checks for library functions. 162AC_CONFIG_FILES( 163Makefile 164src/Makefile 165tester/Makefile 166tools/Makefile 167include/Makefile 168include/belcard/Makefile 169cmake/BelcardConfig.cmake 170belcard.pc 171) 172 173AC_OUTPUT 174