source: trunk/test/yat_pc_test.sh @ 3107

Last change on this file since 3107 was 3107, checked in by Peter, 9 years ago

avoid default make rule in test because it might be problamtic with static libs

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1#! /bin/sh
2# $Id: yat_pc_test.sh 3107 2013-11-04 00:56:25Z peter $
3#
4# Copyright (C) 2013 Peter Johansson
5#
6# This file is part of the yat library, http://dev.thep.lu.se/yat
7#
8# The yat library is free software; you can redistribute it
9# and/or modify it under the terms of the GNU General Public License as
10# published by the Free Software Foundation; either version 3 of the
11# License, or (at your option) any later version.
12#
13# The yat library is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16# General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with yat. If not, see <http://www.gnu.org/licenses/>.
20
21# testing that pkg-config works with yat.pc
22
23required="pkg-config libbam"
24
25set -e
26
27. test/init.sh || exit 99
28
29# test if pkg-config find gsl.pc
30if pkg-config gsl --exists --print-errors; then
31    :
32else
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
46fi
47
48# add PATH so pkg-config find yat.pc in build tree first
49PKG_CONFIG_PATH=$abs_top_builddir/build_support:$PKG_CONFIG_PATH
50export PKG_CONFIG_PATH
51
52pkg-config yat --exists --print-errors || exit_fail
53
54cat > Makefile <<EOF
55# add -I flags to include local header files; 2nd term needed for VPATH build
56CPPFLAGS = -I$abs_top_srcdir -I$abs_top_builddir/yat/utility \
57`pkg-config yat --cflags-only-I`
58CXXFLAGS = `pkg-config yat --cflags-only-other`
59# add -L to link to local libyat
60LDFLAGS = -L$abs_top_builddir/yat/.libs `pkg-config yat --libs --static`
61all: prog
62
63# Default make rule is problematic with static libs
64prog.o: prog.cc
65  \$(CXX) -c -o \$@ \$< \$(CPPFLAGS) \$(CXXFLAGS)
66prog: prog.o
67  \$(CXX) -o \$@ \$< \$(CXXFLAGS) \$(LDFLAGS)
68EOF
69
70cat Makefile
71
72cat > prog.cc <<EOF
73#include <yat/utility/Vector.h>
74#include <yat/random/random.h>
75#include <yat/omic/BamFile.h>
76int main()
77{
78theplu::yat::utility::Vector x(52);
79theplu::yat::random::Gaussian gauss;
80x(0) = gauss();
81theplu::yat::omic::OutBamFile out;
82return 0;
83}
84EOF
85
86rm -f prog
87make || exit_fail
88test -s prog || exit_fail
89exit_success
Note: See TracBrowser for help on using the repository browser.