Changeset 3365


Ignore:
Timestamp:
Dec 1, 2014, 12:14:35 PM (8 years ago)
Author:
Peter
Message:

Use pc from zlib and htslib when linking against those
packages. Rewrite test, so in prologue of test if pkg-config cannot
find pc file, then look in linker's search path. Let libtool inform us
about linker's search path.

fixes #809

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/build_support/Makefile.am

    r3250 r3365  
    4646  -e 's|@YAT_LDFLAGS[@]|$(YAT_LDFLAGS)|g' \
    4747  -e 's|@YAT_PC_LIBS[@]|$(YAT_PC_LIBS)|g' \
     48  -e 's|@YAT_PC_REQUIRES[@]|$(YAT_PC_REQUIRES)|g' \
    4849  -e 's|@YAT_PRIMARY_LIBS[@]|$(YAT_PRIMARY_LIBS)|g' \
    4950  -e 's|@YAT_STATIC_LIBS[@]|$(YAT_STATIC_LIBS)|g' \
  • trunk/build_support/gen_yat_pc.sh.in

    r3111 r3365  
    8585-e 's|@YAT_LDFLAGS[@]|@YAT_LDFLAGS@|g' \
    8686-e 's|@YAT_PC_LIBS[@]|@YAT_PC_LIBS@|g' \
     87-e 's|@YAT_PC_REQUIRES[@]|@YAT_PC_REQUIRES@|g' \
    8788-e 's|@LIBS[@]|@LIBS@|g' \
    8889< $input
  • trunk/build_support/yat.pc.in

    r3111 r3365  
    22
    33# Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    4 # Copyright (C) 2009, 2010, 2012, 2013 Peter Johansson
     4# Copyright (C) 2009, 2010, 2012, 2013, 2014 Peter Johansson
    55#
    66# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2828URL: @PACKAGE_URL@
    2929Version: @VERSION@
    30 Requires: gsl >= @gsl_version@
     30Requires: @YAT_PC_REQUIRES@
    3131Libs: -L${libdir} -lyat @YAT_PC_LIBS@ @YAT_LDFLAGS@ @LDFLAGS@ @LIBS@
    3232Libs.private:
  • trunk/configure.ac

    r3354 r3365  
    373373  YAT_CHECK_HEADER_SAM([],[AC_MSG_FAILURE([header file 'sam.h' was not found])])
    374374  # check if we have hts
    375   YAT_CHECK_HEADER_HTS([AC_DEFINE([YAT_HAVE_HTSLIB],
    376                                   [1], [Define to 1 if HTS is available])])
    377   # try link against libbam
     375  YAT_CHECK_HEADER_HTS([with_hts=yes;
     376                        AC_DEFINE([YAT_HAVE_HTSLIB],
     377                                  [1], [Define to 1 if HTS is available])],
     378                       [with_hts=no])
     379  AC_SUBST([HAVE_HTSLIB], [$with_hts])
     380  # try link against libhts or libbam
    378381  YAT_CHECK_LIBBAM([LIBS="$BAM_LIBS $LIBS"
    379382                    AC_DEFINE([YAT_HAVE_LIBBAM], [1],
    380                               [Define to 1 if libbam is available])],
     383                              [Define to 1 if libhts or libbam is available])],
    381384    [AC_MSG_FAILURE([library 'libbam' was not found])])
    382385  YAT_CHECK_LA_LIBS([
     
    581584# Dependency to GSL is noted via 'Requires' field
    582585YAT_VAR_REMOVE([YAT_PC_LIBS], [-lgsl $YAT_CBLAS_LIB $LIBM])
     586YAT_PC_REQUIRES="gsl > $gsl_version"
     587# ignore this whole bam thing if --without-samtools
     588AS_IF([test x$with_samtools != x"no"], [
     589  # htslib comes with a pc file, so we can require htslib in yat.pc
     590  AS_IF([test x$with_hts = x"yes"], [
     591    YAT_VAR_REMOVE([YAT_PC_LIBS], [$BAM_LIBS -lz])
     592    YAT_PC_REQUIRES="$YAT_PC_REQUIRES htslib"
     593  ],[
     594    # libbam has no pc file, so has to remain in LIBS and instead we
     595    # require zlib
     596    YAT_VAR_REMOVE([YAT_PC_LIBS], [-lz])
     597    YAT_PC_REQUIRES="$YAT_PC_REQUIRES zlib"
     598  ])
     599])
    583600AC_SUBST([YAT_PC_LIBS])
     601AC_SUBST([YAT_PC_REQUIRES])
    584602
    585603AC_SUBST(YAT_LIBS)
  • trunk/test/defs.sh.in

    r3112 r3365  
    139139GSL_CONFIG=@GSL_CONFIG@
    140140YAT_CONFIG=$abs_top_builddir/build_support/yat-config
     141YAT_LDFLAGS="@YAT_LDFLAGS@"
     142LDFLAGS="@LDFLAGS@"
     143HAVE_HTSLIB="@HAVE_HTSLIB@"
    141144
    142145# user is always right
  • trunk/test/yat_pc_test.sh

    r3112 r3365  
    2727. test/init.sh || exit 99
    2828
    29 # test if pkg-config find gsl.pc
    30 if pkg-config gsl --exists --print-errors; then
    31     :
    32 else
    33     # did not find gsl.pc so try tweaking PKG_CONFIG_PATH
    34     $GSL_CONFIG --version || exit_fail
    35     gsl_pc=""
    36     for d in lib lib64; do
    37         dir=`$GSL_CONFIG --prefix`/lib
    38         if test x$gsl_pc = x; then
    39             test -r $dir/pkgconfig/gsl.pc && gsl_pc=$dir/pkgconfig
    40         fi
    41     done
    42     test x$gsl_pc = x && exit_skip cannot find gsl.pc
    43     PKG_CONFIG_PATH=$gsl_pc:$PKG_CONFIG_PATH
    44     export PKG_CONFIG_PATH
    45     pkg-config gsl --exists --print-errors || exit_fail
    46 fi
     29
     30#
     31populate_search_dirs ()
     32{
     33  search_dirs=`grep '^sys_lib_dlsearch_path_spec' \
     34  $abs_top_builddir/libtool | cut -f 2 -d '='`
     35  for d in : $YAT_LDFLAGS $LDFLAGS; do
     36    echo $d | grep '^-L' -q \
     37    && search_dirs="$search_dirs `echo $d | sed 's,-L,,'`"
     38  done
     39}
     40
     41
     42# look for pc file $pkg and update PKG_CONFIG_PATH
     43pc_find ()
     44{
     45  pkg=$1
     46  test x"$search_dirs" = x"" && populate_search_dirs
     47  pc_dir=
     48  for d in $search_dirs; do
     49    test x"$pc_dir" = x"" \
     50    && test -e $d/pkgconfig/${pkg}.pc \
     51    && pc_dir="$d/pkgconfig";
     52  done
     53  test x"$pc_dir" = x"" && exit_fail no $pkg pc file found
     54  PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$pc_dir"
     55  export PKG_CONFIG_PATH
     56  pkg-config $pkg --exists --print-errors || exit_skip no $pkg pc file found
     57}
     58
    4759
    4860# add PATH so pkg-config find yat.pc in build tree first
    4961PKG_CONFIG_PATH=$abs_top_builddir/build_support:$PKG_CONFIG_PATH
     62
     63echo "check if we need to update PKG_CONFIG_PATH"
     64
     65# test if pkg-config finds gsl.pc
     66pkg-config gsl --exists --print-errors || pc_find gsl
     67# ensure path for libz
     68pkg-config libz --exists --print-errors || pc_find zlib
     69
     70if test $HAVE_HTSLIB = yes; then
     71  pkg-config htslib --exists --print-errors || pc_find htslib;
     72fi
     73
    5074export PKG_CONFIG_PATH
    5175
Note: See TracChangeset for help on using the changeset viewer.