[go: up one dir, main page]

Menu

[85d155]: / rmol / rmol.m4.in  Maximize  Restore  History

Download this file

125 lines (101 with data), 4.5 kB

#
# Configure path for the @PACKAGE_NAME@ library.
# Denis Arnaud <denis_arnaud@users.sourceforge.net>, July 2008
#
# Note: as the @PACKAGE_NAME@ 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_@PACKAGE_NAME@],
[
AC_LANG_SAVE
AC_LANG([C++])

AC_ARG_WITH(@PACKAGE@,
	[ --with-@PACKAGE@=PFX   Prefix where @PACKAGE_NAME@ is installed (optional)],
    @PACKAGE@_dir="$withval",
	@PACKAGE@_dir="")

  if test "x${@PACKAGE_NAME@_CONFIG+set}" != xset ; then
     if test "x$@PACKAGE@_dir" != x ; then
         @PACKAGE_NAME@_CONFIG="$@PACKAGE@_dir/bin/@PACKAGE@-config"
     fi
  fi

  AC_PATH_PROG(@PACKAGE_NAME@_CONFIG, @PACKAGE@-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: @PACKAGE_NAME@ 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 @PACKAGE_NAME@ 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: @PACKAGE_NAME@ needs the GSL library, and the GSL_LIBS environment variable does not appears to be set. The @PACKAGE_NAME@ 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: @PACKAGE_NAME@ 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 @PACKAGE_NAME@ 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: @PACKAGE_NAME@ needs Boost Date-Time library, and the BOOST_DATE_TIME_LIB environment variable does not appears to be set. The @PACKAGE_NAME@ may fail to link.])
#	else
#	AC_MSG_RESULT([ok (set to ${BOOST_DATE_TIME_LIB})])
#  fi

  min_@PACKAGE@_version=ifelse([$1], ,0.11.0,$1)
  AC_MSG_CHECKING(for @PACKAGE_NAME@ - version >= $min_@PACKAGE@_version)
  no_@PACKAGE@=""
  if test "${@PACKAGE_NAME@_CONFIG}" = "no" ; then
    no_@PACKAGE@=yes
	AC_MSG_RESULT([no])
  else
	@PACKAGE_NAME@_VERSION=`${@PACKAGE_NAME@_CONFIG} --version`
    @PACKAGE_NAME@_CFLAGS=`${@PACKAGE_NAME@_CONFIG} --cflags`
    @PACKAGE_NAME@_CFLAGS="${GSL_CFLAGS} ${@PACKAGE_NAME@_CFLAGS}"
#    @PACKAGE_NAME@_CFLAGS="${BOOST_CFLAGS} ${@PACKAGE_NAME@_CFLAGS}"
    @PACKAGE_NAME@_LIBS=`${@PACKAGE_NAME@_CONFIG} --libs`
    @PACKAGE_NAME@_LIBS="${GSL_LIBS} ${@PACKAGE_NAME@_LIBS}"
#    @PACKAGE_NAME@_LIBS="${BOOST_LIBS} ${BOOST_DATE_TIME_LIB} ${@PACKAGE_NAME@_LIBS}"

	AC_SUBST([@PACKAGE_NAME@_VERSION])
	AC_SUBST([@PACKAGE_NAME@_CFLAGS])
	AC_SUBST([@PACKAGE_NAME@_LIBS])

    @PACKAGE@_major_version=`echo ${@PACKAGE_NAME@_VERSION} | sed 's/^\([[0-9]]*\).*/\1/'`
    if test "x${@PACKAGE@_major_version}" = "x" ; then
       @PACKAGE@_major_version=0
    fi

    @PACKAGE@_minor_version=`echo ${@PACKAGE_NAME@_VERSION} | \
						sed 's/^\([[0-9]]*\)\.\{0,1\}\([[0-9]]*\).*/\2/'`
    if test "x${@PACKAGE@_minor_version}" = "x" ; then
       @PACKAGE@_minor_version=0
    fi

    @PACKAGE@_micro_version=`echo ${@PACKAGE_NAME@_VERSION} | \
          sed 's/^\([[0-9]]*\)\.\{0,1\}\([[0-9]]*\)\.\{0,1\}\([[0-9]]*\).*/\3/'`
    if test "x${@PACKAGE@_micro_version}" = "x" ; then
       @PACKAGE@_micro_version=0
    fi


	SAVED_CPPFLAGS="${CPPFLAGS}"
	SAVED_LDFLAGS="${LDFLAGS}"
	CPPFLAGS="${CPPFLAGS} ${GSL_CFLAGS} ${BOOST_CFLAGS} ${@PACKAGE_NAME@_CFLAGS}"
	LDFLAGS="${LDFLAGS} ${GSL_LIBS} ${@PACKAGE_NAME@_LIBS}"


   	AC_COMPILE_IFELSE(
		AC_LANG_PROGRAM([[
				#include <@PACKAGE@/@PACKAGE_NAME@_Service.hpp> 
				]],
				[[int i=0;]]
		)
		,

    	[AC_MSG_RESULT([yes (${@PACKAGE_NAME@_VERSION})])],

		[
		AC_MSG_ERROR([We could not compile a simple @PACKAGE_NAME@ example. See config.log.])
		]
	)

	CPPFLAGS="${SAVED_CPPFLAGS}"
	LDFLAGS="${SAVED_LDFLAGS}"

  fi

AC_LANG_RESTORE
])