From: <den...@us...> - 2010-09-06 10:21:07
|
Revision: 306 http://stdair.svn.sourceforge.net/stdair/?rev=306&view=rev Author: denis_arnaud Date: 2010-09-06 10:21:00 +0000 (Mon, 06 Sep 2010) Log Message: ----------- [Config] Added a M4 macro file for StdAir. Added Paths: ----------- trunk/stdair/config/stdair.m4 Added: trunk/stdair/config/stdair.m4 =================================================================== --- trunk/stdair/config/stdair.m4 (rev 0) +++ trunk/stdair/config/stdair.m4 2010-09-06 10:21:00 UTC (rev 306) @@ -0,0 +1,124 @@ +# +# Configure path for the STDAIR library. +# Denis Arnaud <den...@us...>, July 2008 +# +# Note: as the STDAIR library depends upon GSL (and +# potentially BOOST) to build. Your configure.ac must define +# appropriately the GSL_CFLAGS (and potentially BOOST_CFLAGS) +# variables. +# + + +AC_DEFUN([AM_PATH_STDAIR], +[ +AC_LANG_SAVE +AC_LANG([C++]) + +AC_ARG_WITH(stdair, + [ --with-stdair=PFX Prefix where STDAIR is installed (optional)], + stdair_dir="$withval", + stdair_dir="") + + if test "x${STDAIR_CONFIG+set}" != xset ; then + if test "x$stdair_dir" != x ; then + STDAIR_CONFIG="$stdair_dir/bin/stdair-config" + fi + fi + + AC_PATH_PROG(STDAIR_CONFIG, stdair-config, no) + + # Check whether Boost flags and libraries are defined + AC_MSG_CHECKING(for GSL_CFLAGS environment variable) + if test x"${GSL_CFLAGS}" = x; then + AC_MSG_RESULT([Warning: STDAIR needs the GSL, and the GSL_CFLAGS environment variable does not appear to be set. It may not be a problem, though, if your Unix distribution is standard, that is, if GSL is installed in /usr/local. Otherwise, the STDAIR will fail to compile.]) + else + AC_MSG_RESULT([ok (set to ${GSL_CFLAGS})]) + fi + + AC_MSG_CHECKING(for GSL_LIBS environment variable) + if test x"${GSL_LIBS}" = x; then + AC_MSG_RESULT([Warning: STDAIR needs the GSL library, and the GSL_LIBS environment variable does not appears to be set. The STDAIR may fail to link.]) + else + AC_MSG_RESULT([ok (set to ${GSL_LIBS})]) + fi + + # Check whether Boost flags and libraries are defined +# AC_MSG_CHECKING(for BOOST_CFLAGS environment variable) +# if test x"${BOOST_CFLAGS}" = x; then +# AC_MSG_RESULT([Warning: STDAIR needs Boost, and the BOOST_CFLAGS environment variable does not appear to be set. It may not be a problem, though, if your Unix distribution is standard, that is, if Boost is installed in /usr/local. Otherwise, the STDAIR will fail to compile.]) +# else +# AC_MSG_RESULT([ok (set to ${BOOST_CFLAGS})]) +# fi + +# AC_MSG_CHECKING(for BOOST_DATE_TIME_LIB environment variable) +# if test x"${BOOST_DATE_TIME_LIB}" = x; then +# AC_MSG_RESULT([Warning: STDAIR needs Boost Date-Time library, and the BOOST_DATE_TIME_LIB environment variable does not appears to be set. The STDAIR may fail to link.]) +# else +# AC_MSG_RESULT([ok (set to ${BOOST_DATE_TIME_LIB})]) +# fi + + min_stdair_version=ifelse([$1], ,0.11.0,$1) + AC_MSG_CHECKING(for STDAIR - version >= $min_stdair_version) + no_stdair="" + if test "${STDAIR_CONFIG}" = "no" ; then + no_stdair=yes + AC_MSG_RESULT([no]) + else + STDAIR_VERSION=`${STDAIR_CONFIG} --version` + STDAIR_CFLAGS=`${STDAIR_CONFIG} --cflags` + STDAIR_CFLAGS="${GSL_CFLAGS} ${STDAIR_CFLAGS}" +# STDAIR_CFLAGS="${BOOST_CFLAGS} ${STDAIR_CFLAGS}" + STDAIR_LIBS=`${STDAIR_CONFIG} --libs` + STDAIR_LIBS="${GSL_LIBS} ${STDAIR_LIBS}" +# STDAIR_LIBS="${BOOST_LIBS} ${BOOST_DATE_TIME_LIB} ${STDAIR_LIBS}" + + AC_SUBST([STDAIR_VERSION]) + AC_SUBST([STDAIR_CFLAGS]) + AC_SUBST([STDAIR_LIBS]) + + stdair_major_version=`echo ${STDAIR_VERSION} | sed 's/^\([[0-9]]*\).*/\1/'` + if test "x${stdair_major_version}" = "x" ; then + stdair_major_version=0 + fi + + stdair_minor_version=`echo ${STDAIR_VERSION} | \ + sed 's/^\([[0-9]]*\)\.\{0,1\}\([[0-9]]*\).*/\2/'` + if test "x${stdair_minor_version}" = "x" ; then + stdair_minor_version=0 + fi + + stdair_micro_version=`echo ${STDAIR_VERSION} | \ + sed 's/^\([[0-9]]*\)\.\{0,1\}\([[0-9]]*\)\.\{0,1\}\([[0-9]]*\).*/\3/'` + if test "x${stdair_micro_version}" = "x" ; then + stdair_micro_version=0 + fi + + + SAVED_CPPFLAGS="${CPPFLAGS}" + SAVED_LDFLAGS="${LDFLAGS}" + CPPFLAGS="${CPPFLAGS} ${GSL_CFLAGS} ${BOOST_CFLAGS} ${STDAIR_CFLAGS}" + LDFLAGS="${LDFLAGS} ${GSL_LIBS} ${STDAIR_LIBS}" + + + AC_COMPILE_IFELSE( + AC_LANG_PROGRAM([[ + #include <stdair/STDAIR_Service.hpp> + ]], + [[int i=0;]] + ) + , + + [AC_MSG_RESULT([yes (${STDAIR_VERSION})])], + + [ + AC_MSG_ERROR([We could not compile a simple STDAIR example. See config.log.]) + ] + ) + + CPPFLAGS="${SAVED_CPPFLAGS}" + LDFLAGS="${SAVED_LDFLAGS}" + + fi + +AC_LANG_RESTORE +]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |