How to compile an external module in C++ for Yate

From Yate Documentation
(Difference between revisions)
Jump to: navigation, search
(Created page with " Write an external module in C++ following the coding styles (this is recommended not required) ==Install Yate== To use an external module you need to have Yate already in...")
 
Line 1: Line 1:
  
 
Write an external module in C++ following the coding styles (this is recommended not required)
 
  
 
==Install Yate==
 
==Install Yate==
Line 19: Line 17:
 
===Write configure.in===
 
===Write configure.in===
  
This file is process with autoconf to produce a configure script.
+
This file is process with autoconf to produce a configure script.<br>
 +
It contains tests that check for conditions that are likely to differ on different platforms. The tests are made by actually invoke autoconf macros.  
  
 
Typical layout:
 
Typical layout:
Line 38: Line 37:
 
For Yate's detection the following parameters are required:
 
For Yate's detection the following parameters are required:
  
YATE_VER=""
+
YATE_VER=""
YATE_INC=""
+
YATE_INC=""
YATE_LIB=""
+
YATE_LIB=""
YATE_STR=""
+
YATE_STR=""
YATE_MOD=""
+
YATE_MOD=""
YATE_SCR=""
+
YATE_SCR=""
YATE_SKN=""
+
YATE_SKN=""
YATE_CFG=""
+
YATE_CFG=""
yc="yate-config"
+
yc="yate-config"
 
+
AC_ARG_WITH(yate,AC_HELP_STRING([--with-yate=DIR],[use Yate from DIR]),[ac_cv_use_yate=$withval],[ac_cv_use_yate=yes])
+
AC_ARG_WITH(yate,AC_HELP_STRING([--with-yate=DIR],[use Yate from DIR]),[ac_cv_use_yate=$withval],[ac_cv_use_yate=yes])
 
+
AC_MSG_CHECKING([for Yate using $yc])
+
AC_MSG_CHECKING([for Yate using $yc])
YATE_VER=`"$yc" --version 2>/dev/null`
+
YATE_VER=`"$yc" --version 2>/dev/null`
YATE_INC=`"$yc" --c-all 2>/dev/null`
+
YATE_INC=`"$yc" --c-all 2>/dev/null`
YATE_LIB="$YATE_LIB"`"$yc" --ld-nostrip 2>/dev/null`
+
YATE_LIB="$YATE_LIB"`"$yc" --ld-nostrip 2>/dev/null`
YATE_STR=`"$yc" --ld-strip 2>/dev/null`
+
YATE_STR=`"$yc" --ld-strip 2>/dev/null`
YATE_MOD=`"$yc" --modules 2>/dev/null`
+
YATE_MOD=`"$yc" --modules 2>/dev/null`
YATE_SCR=`"$yc" --scripts 2>/dev/null`
+
YATE_SCR=`"$yc" --scripts 2>/dev/null`
YATE_SKN=`"$yc" --skins 2>/dev/null`
+
YATE_SKN=`"$yc" --skins 2>/dev/null`
YATE_CFG=`"$yc" --config 2>/dev/null`
+
YATE_CFG=`"$yc" --config 2>/dev/null`
if [[ "x$YATE_VER" = "x" ]]; then
+
if [[ "x$YATE_VER" = "x" ]]; then
 
     YATE_VER="no"
 
     YATE_VER="no"
fi
+
fi
AC_MSG_RESULT([$YATE_VER])
+
AC_MSG_RESULT([$YATE_VER])
if [[ "x$YATE_VER" = "xno" ]]; then
+
if [[ "x$YATE_VER" = "xno" ]]; then
    AC_ERROR([Could not find Yate])
+
    AC_ERROR([Could not find Yate])
fi
+
fi
fi
+
fi
  
  

Revision as of 18:14, 3 December 2012


Contents

Install Yate

To use an external module you need to have Yate already installed. This can be done in two ways:

  • Yate is installed from SVN source, the needed headers files are obtained in this way
  • Development packages for Yate including headers and shared libraries (typically this is called yate-devel but depends on distribution).

Compile an external module

When compiling an external module, it is recommended to have autogen.sh. This way, the build system will detect if the Yate headers are correctly installed, and their paths. When running autogen.sh an executable file is produced, configure from configure.in. Then configure is run and Makefile is produced using Makefile.in.

So, to start using the Yate's build system with your software package it is recommended to write the files bellow.

Write configure.in

This file is process with autoconf to produce a configure script.
It contains tests that check for conditions that are likely to differ on different platforms. The tests are made by actually invoke autoconf macros.

Typical layout:

  • AC_INIT(package, version) - perform initialisation and verification - sets the name of the package (name of the external module) and its version.
  • package information
  • program checks
  • library checks
  • header file checks
  • type checks
  • structure checks
  • compiler characteristics checks
  • library functions check
  • system service checks
  • AC_CONFIG_FILES([...])
  • AC_OUTPUT

For Yate's detection the following parameters are required:

YATE_VER=""
YATE_INC=""
YATE_LIB=""
YATE_STR=""
YATE_MOD=""
YATE_SCR=""
YATE_SKN=""
YATE_CFG=""
yc="yate-config"

AC_ARG_WITH(yate,AC_HELP_STRING([--with-yate=DIR],[use Yate from DIR]),[ac_cv_use_yate=$withval],[ac_cv_use_yate=yes])

AC_MSG_CHECKING([for Yate using $yc])
YATE_VER=`"$yc" --version 2>/dev/null`
YATE_INC=`"$yc" --c-all 2>/dev/null`
YATE_LIB="$YATE_LIB"`"$yc" --ld-nostrip 2>/dev/null`
YATE_STR=`"$yc" --ld-strip 2>/dev/null`
YATE_MOD=`"$yc" --modules 2>/dev/null`
YATE_SCR=`"$yc" --scripts 2>/dev/null`
YATE_SKN=`"$yc" --skins 2>/dev/null`
YATE_CFG=`"$yc" --config 2>/dev/null`
if  "x$YATE_VER" = "x" ; then
   YATE_VER="no"
fi
AC_MSG_RESULT([$YATE_VER])
if  "x$YATE_VER" = "xno" ; then
    AC_ERROR([Could not find Yate])
fi
fi


Write Makefile.in

This file holds the make rules for a Yate module

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers