Changeset 3054


Ignore:
Timestamp:
Jun 15, 2013, 1:41:42 AM (8 years ago)
Author:
Peter
Message:

fetch flags directly from yat-config as variables YAT_* might be unpopulated; barf out properly if yat-config is unavalibale; document macro. closes #757

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/m4/yat.m4

    r3053 r3054  
    8282#     ACTION-IF-FOUND. On failure execute ACTION-IF-NOT-FOUND.
    8383#
     84#   YAT_CHECK_LIB_WITH_BAM([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
     85#
     86#     Test if libyat has bam support. Compile a small program using
     87#     class omic::InBamFile and link it to libyat. On success execute
     88#     ACTION-IF-FOUND. On failure execute ACTION-IF-NOT-FOUND. Macro
     89#     requires that yat-config is available, see YAT_FIND_YAT above.
    8490#
    8591#
     
    9197#
    9298#   Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    93 #   Copyright (C) 2009, 2010, 2011, 2012 Peter Johansson
     99#   Copyright (C) 2009, 2010, 2011, 2012, 2013 Peter Johansson
    94100#
    95101#   This file is part of the yat library, http://dev.thep.lu.se/yat
     
    167173        ])
    168174    ])
    169 
    170175  _YAT_ACTION([test "$yat_config" != "no"],[$1],[$2])
    171 
    172 
    173176]) # YAT_FIND_YAT
    174177
     
    195198    m4_popdef([yat_min_version]) dnl
    196199  fi
    197 
    198200  _YAT_ACTION([test "$ac_yat_version_ok" = "yes"],[$2],[$3])
    199 
    200201]) # YAT_CHECK_VERSION
    201202
     
    246247           ac_yat_ok=yes;
    247248           AC_SUBST(YAT_CPPFLAGS)
    248            AC_SUBST(YAT_CXXFLAGS)
    249            AC_DEFINE([HAVE_YAT],[1],[define if yat library is available])
     249           AC_SUBST(YAT_CXXFLAGS)
     250           AC_DEFINE([HAVE_YAT],[1],[define if yat library is available])
    250251          ], [
    251252           AC_MSG_WARN([
     
    259260    CXXFLAGS=$ac_yat_save_CXXFLAGS
    260261  fi
    261 
    262262  _YAT_ACTION([test "$ac_yat_ok" = "yes"],[$1],[$2])
    263 
    264263]) # YAT_CHECK_HEADER
    265264
     
    285284    AS_IF([test x$yat_cv_lib_yat = xyes], [
    286285                    ac_yat_ok="yes";
    287                     AC_SUBST(YAT_LDFLAGS)
     286                    AC_SUBST(YAT_LDFLAGS)
    288287                    AC_SUBST(YAT_LIBS)
    289288                    # be compatible with yat-config 0.5.x
     
    315314  AC_PREREQ([2.60]) dnl we use YAT_FIND_YAT
    316315  AC_REQUIRE([YAT_FIND_YAT])  dnl
    317   ac_yat_save_CPPFLAGS=$CPPFLAGS
    318   ac_yat_save_CXXFLAGS=$CXXFLAGS
    319   ac_yat_save_LDFLAGS=$LDFLAGS
    320   ac_yat_save_LIBS=$LIBS
    321   CPPFLAGS="$CPPFLAGS $YAT_CPPFLAGS"
    322   CXXFLAGS="$CXXFLAGS $YAT_CXXFLAGS"
    323   LDFLAGS="$LDFLAGS $YAT_LDFLAGS"
    324   LIBS="$LIBS $YAT_LIBS"
    325   AC_LANG_ASSERT([C++])
    326   AC_CACHE_CHECK([for class BamInFile],
    327                  [yat_cv_lib_with_bam],
    328                  [AC_LINK_IFELSE([
    329                      AC_LANG_PROGRAM([[@%:@include <yat/omic/BamFile.h>]],
    330                                      [using namespace theplu::yat::omic;
    331                                       InBamFile is("myfile");])
    332                    ],[
    333                      yat_cv_lib_with_bam=yes
    334                    ],[
    335                      yat_cv_lib_with_bam=no
     316  AS_IF([test x"$yat_config" = x""], [
     317    yat_cv_lib_with_bam=no
     318  ],[
     319    ac_yat_save_CPPFLAGS=$CPPFLAGS
     320    ac_yat_save_CXXFLAGS=$CXXFLAGS
     321    ac_yat_save_LDFLAGS=$LDFLAGS
     322    ac_yat_save_LIBS=$LIBS
     323    CPPFLAGS="$CPPFLAGS `$yat_config --cppflags`"
     324    CXXFLAGS="$CXXFLAGS `$yat_config --cxxflags`"
     325    LDFLAGS="$LDFLAGS `$yat_config --ldflags`"
     326    LIBS="$LIBS `$yat_config --libs`"
     327    AC_LANG_ASSERT([C++])
     328    AC_CACHE_CHECK([for class BamInFile],
     329                   [yat_cv_lib_with_bam],
     330                   [AC_LINK_IFELSE([
     331                       AC_LANG_PROGRAM([[@%:@include <yat/omic/BamFile.h>]],
     332                                       [using namespace theplu::yat::omic;
     333                                        InBamFile is("myfile");])
     334                     ],[
     335                       yat_cv_lib_with_bam=yes
     336                     ],[
     337                       yat_cv_lib_with_bam=no
     338                     ])
    336339                   ])
    337                  ])
    338 
    339   # restore FLAGS
    340   CPPFLAGS=$ac_yat_save_CPPFLAGS
    341   CXXFLAGS=$ac_yat_save_CXXFLAGS
    342   LDFLAGS=$ac_yat_save_LDFLAGS
    343   LIBS=$ac_yat_save_LIBS
    344   AS_CASE([$yat_cv_lib_with_bam], [yes], [$1], [no], [$2])
     340
     341    # restore FLAGS
     342    CPPFLAGS=$ac_yat_save_CPPFLAGS
     343    CXXFLAGS=$ac_yat_save_CXXFLAGS
     344    LDFLAGS=$ac_yat_save_LDFLAGS
     345    LIBS=$ac_yat_save_LIBS
     346  ])
     347  AS_CASE([$yat_cv_lib_with_bam],
     348          [yes], [$1],
     349          [no], [$2])
    345350]) # YAT_CHECK_LIB_WITH_BAM
    346351
Note: See TracChangeset for help on using the changeset viewer.