Changeset 3366


Ignore:
Timestamp:
Dec 3, 2014, 12:23:07 PM (5 years ago)
Author:
Peter
Message:

prefer private variables in yat.pc. closes #808

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/build_support/gen_yat_pc.sh.in

    r3365 r3366  
    8585-e 's|@YAT_LDFLAGS[@]|@YAT_LDFLAGS@|g' \
    8686-e 's|@YAT_PC_LIBS[@]|@YAT_PC_LIBS@|g' \
     87-e 's|@YAT_PC_LIBS_PRIVATE[@]|@YAT_PC_LIBS_PRIVATE@|g' \
    8788-e 's|@YAT_PC_REQUIRES[@]|@YAT_PC_REQUIRES@|g' \
     89-e 's|@YAT_PC_REQUIRES_PRIVATE[@]|@YAT_PC_REQUIRES_PRIVATE@|g' \
    8890-e 's|@LIBS[@]|@LIBS@|g' \
    8991< $input
  • trunk/build_support/yat.pc.in

    r3365 r3366  
    2929Version: @VERSION@
    3030Requires: @YAT_PC_REQUIRES@
     31Requires.private: @YAT_PC_REQUIRES_PRIVATE@
    3132Libs: -L${libdir} -lyat @YAT_PC_LIBS@ @YAT_LDFLAGS@ @LDFLAGS@ @LIBS@
    32 Libs.private:
     33Libs.private: @YAT_PC_LIBS_PRIVATE@
    3334Cflags: @YAT_CPPFLAGS@ @YAT_CXXFLAGS@ @CPPFLAGS@ @CXXFLAGS@ -I${includedir}
  • trunk/configure.ac

    r3365 r3366  
    581581
    582582# Assign LIBS variables for yat.pc
    583 YAT_PC_LIBS=$YAT_LIBS
     583YAT_PC_LIBS_PRIVATE=$YAT_LIBS
     584
    584585# Dependency to GSL is noted via 'Requires' field
    585 YAT_VAR_REMOVE([YAT_PC_LIBS], [-lgsl $YAT_CBLAS_LIB $LIBM])
    586 YAT_PC_REQUIRES="gsl > $gsl_version"
     586YAT_VAR_REMOVE([YAT_PC_LIBS_PRIVATE], [-lgsl $YAT_CBLAS_LIB $LIBM])
     587YAT_SET_CONTAINS([$yat_libyat_la_LIBADD], [-lgsl], [
     588  YAT_PC_REQUIRES_PRIVATE="gsl > $gsl_version"
     589], [
     590  YAT_PC_REQUIRES="gsl > $gsl_version"
     591])
     592
    587593# ignore this whole bam thing if --without-samtools
    588594AS_IF([test x$with_samtools != x"no"], [
    589595  # htslib comes with a pc file, so we can require htslib in yat.pc
    590596  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"
     597    YAT_VAR_REMOVE([YAT_PC_LIBS_PRIVATE], [$BAM_LIBS -lz])
     598    YAT_SET_CONTAINS([$yat_libyat_la_LIBADD], [-lhts], [
     599      YAT_PC_REQUIRES_PRIVATE="$YAT_PC_REQUIRES_PRIVATE htslib"
     600    ], [
     601      YAT_PC_REQUIRES="$YAT_PC_REQUIRES htslib"
     602    ])
    593603  ],[
    594604    # libbam has no pc file, so has to remain in LIBS and instead we
    595605    # require zlib
    596     YAT_VAR_REMOVE([YAT_PC_LIBS], [-lz])
     606    YAT_VAR_REMOVE([YAT_PC_LIBS_PRIVATE], [-lz])
    597607    YAT_PC_REQUIRES="$YAT_PC_REQUIRES zlib"
    598   ])
    599 ])
     608    YAT_SET_CONTAINS([$yat_libyat_la_LIBADD], [-lz], [
     609      YAT_PC_REQUIRES_PRIVATE="$YAT_PC_REQUIRES_PRIVATE zlib"
     610    ], [
     611      YAT_PC_REQUIRES="$YAT_PC_REQUIRES zlib"
     612    ])
     613  ])
     614])
     615
     616# Having libs declared as LIBS.private in yat.pc assumes that libs
     617# have been linked into libyat. Therefore for each lib check if it is
     618# mentioned in $yat_libyat_la_LIBADD, and if it's not move
     619# lib to LIBS variable.
     620for lib in $YAT_PC_LIBS_PRIVATE; do
     621  YAT_SET_CONTAINS([$yat_libyat_la_LIBADD], [$lib], [
     622  ], [
     623    # move lib from $YAT_PC_LIBS_PRIVATE to $YAT_PC_LIBS
     624    YAT_VAR_REMOVE([$YAT_PC_LIBS_PRIVATE], [$lib])
     625    YAT_PC_LIBS="$YAT_PC_LIBS $lib"
     626  ])
     627done
     628
    600629AC_SUBST([YAT_PC_LIBS])
    601630AC_SUBST([YAT_PC_REQUIRES])
     631AC_SUBST([YAT_PC_LIBS_PRIVATE])
     632AC_SUBST([YAT_PC_REQUIRES_PRIVATE])
    602633
    603634AC_SUBST(YAT_LIBS)
  • trunk/m4/yat_common.m4

    r3114 r3366  
    5555
    5656
     57# YAT_SET_CONTAINS(set, value, [if-present], [if-not-present])
     58# ============================================================
     59# Loop over set (space-separated) and if value exists, execute
     60# if-present. otherwise execute if-not-present
     61AC_DEFUN([YAT_SET_CONTAINS],
     62[
     63AS_IF([AS_ECHO([$1]) | tr ' ' '\n' | grep '^$2$' > /dev/null], [$3], [$4])
     64]) #YAT_SET_CONTAINS
     65
     66
    5767# YAT_VAR_REMOVE(VAR, LIST)
    5868# ==========================
Note: See TracChangeset for help on using the changeset viewer.