source: trunk/test/yat_pc_test.sh @ 2976

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

use --static switch to avoid failure on OSX4

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.3 KB
Line 
1#! /bin/sh
2# $Id: yat_pc_test.sh 2976 2013-01-29 13:11:05Z 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"
24
25set -e
26
27. test/common_defs.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
62EOF
63
64cat Makefile
65
66cat > prog.cc <<EOF
67#include <yat/utility/Vector.h>
68#include <yat/random/random.h>
69#include <yat/omic/BamFile.h>
70int main()
71{
72theplu::yat::utility::Vector x(52);
73theplu::yat::random::Gaussian gauss;
74x(0) = gauss();
75theplu::yat::omic::OutBamFile out;
76return 0;
77}
78EOF
79
80rm -f prog
81make || exit_fail
82test -s prog || exit_fail
83exit_success
Note: See TracBrowser for help on using the repository browser.