2950 |
11 Jan 13 |
peter |
#! /bin/sh |
2950 |
11 Jan 13 |
peter |
# $Id$ |
2950 |
11 Jan 13 |
peter |
3 |
# |
3966 |
11 Aug 20 |
peter |
# Copyright (C) 2013, 2014, 2015, 2017, 2020 Peter Johansson |
2950 |
11 Jan 13 |
peter |
5 |
# |
2950 |
11 Jan 13 |
peter |
# This file is part of the yat library, http://dev.thep.lu.se/yat |
2950 |
11 Jan 13 |
peter |
7 |
# |
2950 |
11 Jan 13 |
peter |
# The yat library is free software; you can redistribute it |
2950 |
11 Jan 13 |
peter |
# and/or modify it under the terms of the GNU General Public License as |
2950 |
11 Jan 13 |
peter |
# published by the Free Software Foundation; either version 3 of the |
2950 |
11 Jan 13 |
peter |
# License, or (at your option) any later version. |
2950 |
11 Jan 13 |
peter |
12 |
# |
2950 |
11 Jan 13 |
peter |
# The yat library is distributed in the hope that it will be useful, |
2950 |
11 Jan 13 |
peter |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2950 |
11 Jan 13 |
peter |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2950 |
11 Jan 13 |
peter |
# General Public License for more details. |
2950 |
11 Jan 13 |
peter |
17 |
# |
2950 |
11 Jan 13 |
peter |
# You should have received a copy of the GNU General Public License |
2950 |
11 Jan 13 |
peter |
# along with yat. If not, see <http://www.gnu.org/licenses/>. |
2950 |
11 Jan 13 |
peter |
20 |
|
2950 |
11 Jan 13 |
peter |
# testing that pkg-config works with yat.pc |
2950 |
11 Jan 13 |
peter |
22 |
|
3400 |
30 Mar 15 |
peter |
23 |
required="pkg-config htslib" |
2950 |
11 Jan 13 |
peter |
24 |
|
2950 |
11 Jan 13 |
peter |
25 |
set -e |
2950 |
11 Jan 13 |
peter |
26 |
|
3036 |
03 Jun 13 |
peter |
27 |
. test/init.sh || exit 99 |
2950 |
11 Jan 13 |
peter |
28 |
|
2950 |
11 Jan 13 |
peter |
29 |
|
3365 |
01 Dec 14 |
peter |
30 |
# |
3365 |
01 Dec 14 |
peter |
31 |
populate_search_dirs () |
3365 |
01 Dec 14 |
peter |
32 |
{ |
3365 |
01 Dec 14 |
peter |
33 |
search_dirs=`grep '^sys_lib_dlsearch_path_spec' \ |
3365 |
01 Dec 14 |
peter |
34 |
$abs_top_builddir/libtool | cut -f 2 -d '='` |
3365 |
01 Dec 14 |
peter |
35 |
for d in : $YAT_LDFLAGS $LDFLAGS; do |
3365 |
01 Dec 14 |
peter |
36 |
echo $d | grep '^-L' -q \ |
3365 |
01 Dec 14 |
peter |
37 |
&& search_dirs="$search_dirs `echo $d | sed 's,-L,,'`" |
3365 |
01 Dec 14 |
peter |
38 |
done |
3365 |
01 Dec 14 |
peter |
39 |
} |
3365 |
01 Dec 14 |
peter |
40 |
|
3365 |
01 Dec 14 |
peter |
41 |
|
3365 |
01 Dec 14 |
peter |
# look for pc file $pkg and update PKG_CONFIG_PATH |
3365 |
01 Dec 14 |
peter |
43 |
pc_find () |
3365 |
01 Dec 14 |
peter |
44 |
{ |
3365 |
01 Dec 14 |
peter |
45 |
pkg=$1 |
3365 |
01 Dec 14 |
peter |
46 |
test x"$search_dirs" = x"" && populate_search_dirs |
3365 |
01 Dec 14 |
peter |
47 |
pc_dir= |
3365 |
01 Dec 14 |
peter |
48 |
for d in $search_dirs; do |
3365 |
01 Dec 14 |
peter |
49 |
test x"$pc_dir" = x"" \ |
3365 |
01 Dec 14 |
peter |
50 |
&& test -e $d/pkgconfig/${pkg}.pc \ |
3365 |
01 Dec 14 |
peter |
51 |
&& pc_dir="$d/pkgconfig"; |
3365 |
01 Dec 14 |
peter |
52 |
done |
3365 |
01 Dec 14 |
peter |
53 |
test x"$pc_dir" = x"" && exit_fail no $pkg pc file found |
3365 |
01 Dec 14 |
peter |
54 |
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$pc_dir" |
3365 |
01 Dec 14 |
peter |
55 |
export PKG_CONFIG_PATH |
3945 |
20 Jul 20 |
peter |
56 |
$PKG_CONFIG $pkg --exists --print-errors || exit_skip no $pkg pc file found |
3365 |
01 Dec 14 |
peter |
57 |
} |
3365 |
01 Dec 14 |
peter |
58 |
|
3588 |
19 Jan 17 |
peter |
59 |
PATH="$abs_top_builddir/build_support:$PATH" |
3588 |
19 Jan 17 |
peter |
60 |
export PATH |
3365 |
01 Dec 14 |
peter |
61 |
|
2950 |
11 Jan 13 |
peter |
# add PATH so pkg-config find yat.pc in build tree first |
2950 |
11 Jan 13 |
peter |
63 |
PKG_CONFIG_PATH=$abs_top_builddir/build_support:$PKG_CONFIG_PATH |
3365 |
01 Dec 14 |
peter |
64 |
|
3365 |
01 Dec 14 |
peter |
65 |
echo "check if we need to update PKG_CONFIG_PATH" |
3365 |
01 Dec 14 |
peter |
66 |
|
3365 |
01 Dec 14 |
peter |
# test if pkg-config finds gsl.pc |
3945 |
20 Jul 20 |
peter |
68 |
$PKG_CONFIG gsl --exists --print-errors || pc_find gsl |
3933 |
10 Jul 20 |
peter |
# ensure path for zlib |
3945 |
20 Jul 20 |
peter |
70 |
$PKG_CONFIG zlib --exists --print-errors || pc_find zlib |
3365 |
01 Dec 14 |
peter |
71 |
|
3906 |
08 May 20 |
peter |
72 |
if test $have_htslib = yes; then |
3945 |
20 Jul 20 |
peter |
73 |
$PKG_CONFIG htslib --exists --print-errors || pc_find htslib; |
3365 |
01 Dec 14 |
peter |
74 |
fi |
3365 |
01 Dec 14 |
peter |
75 |
|
2950 |
11 Jan 13 |
peter |
76 |
export PKG_CONFIG_PATH |
2950 |
11 Jan 13 |
peter |
77 |
|
3945 |
20 Jul 20 |
peter |
78 |
$PKG_CONFIG yat --exists --print-errors || exit_fail |
2950 |
11 Jan 13 |
peter |
79 |
|
2950 |
11 Jan 13 |
peter |
80 |
cat > Makefile <<EOF |
3582 |
19 Jan 17 |
peter |
81 |
CXX = `yat-config --cxx` |
2950 |
11 Jan 13 |
peter |
# add -I flags to include local header files; 2nd term needed for VPATH build |
4019 |
06 Nov 20 |
peter |
83 |
CPPFLAGS = -I$abs_top_srcdir -I$abs_top_builddir \ |
4019 |
06 Nov 20 |
peter |
84 |
-I$abs_top_builddir/yat/utility \ |
3945 |
20 Jul 20 |
peter |
85 |
`$PKG_CONFIG yat --cflags-only-I` |
3945 |
20 Jul 20 |
peter |
86 |
CXXFLAGS = `$PKG_CONFIG yat --cflags-only-other` |
2950 |
11 Jan 13 |
peter |
# add -L to link to local libyat |
3966 |
11 Aug 20 |
peter |
88 |
LDFLAGS = -L$abs_top_builddir/yat/${lt_cv_objdir} `$PKG_CONFIG yat --libs-only-L --libs-only-other` |
3966 |
11 Aug 20 |
peter |
89 |
LDLIBS = `$PKG_CONFIG yat --libs-only-l` |
3966 |
11 Aug 20 |
peter |
90 |
|
2950 |
11 Jan 13 |
peter |
91 |
all: prog |
3107 |
04 Nov 13 |
peter |
92 |
|
3966 |
11 Aug 20 |
peter |
# Make the rules explicit to allow also non-GNU make. |
3107 |
04 Nov 13 |
peter |
94 |
prog.o: prog.cc |
3107 |
04 Nov 13 |
peter |
95 |
\$(CXX) -c -o \$@ \$< \$(CPPFLAGS) \$(CXXFLAGS) |
3107 |
04 Nov 13 |
peter |
96 |
prog: prog.o |
3966 |
11 Aug 20 |
peter |
97 |
\$(CXX) -o \$@ \$< \$(CXXFLAGS) \$(LDFLAGS) \$(LDLIBS) |
2950 |
11 Jan 13 |
peter |
98 |
EOF |
2950 |
11 Jan 13 |
peter |
99 |
|
2950 |
11 Jan 13 |
peter |
100 |
cat Makefile |
2950 |
11 Jan 13 |
peter |
101 |
|
2950 |
11 Jan 13 |
peter |
102 |
cat > prog.cc <<EOF |
2950 |
11 Jan 13 |
peter |
#include <yat/utility/Vector.h> |
2950 |
11 Jan 13 |
peter |
#include <yat/random/random.h> |
2950 |
11 Jan 13 |
peter |
#include <yat/omic/BamFile.h> |
3966 |
11 Aug 20 |
peter |
#include <yat/omic/VcfFile.h> |
2950 |
11 Jan 13 |
peter |
107 |
int main() |
2950 |
11 Jan 13 |
peter |
108 |
{ |
2950 |
11 Jan 13 |
peter |
109 |
theplu::yat::utility::Vector x(52); |
2950 |
11 Jan 13 |
peter |
110 |
theplu::yat::random::Gaussian gauss; |
2950 |
11 Jan 13 |
peter |
111 |
x(0) = gauss(); |
2950 |
11 Jan 13 |
peter |
112 |
theplu::yat::omic::OutBamFile out; |
3966 |
11 Aug 20 |
peter |
113 |
theplu::yat::omic::VcfFile vcf; |
2950 |
11 Jan 13 |
peter |
114 |
return 0; |
2950 |
11 Jan 13 |
peter |
115 |
} |
2950 |
11 Jan 13 |
peter |
116 |
EOF |
2950 |
11 Jan 13 |
peter |
117 |
|
2950 |
11 Jan 13 |
peter |
118 |
rm -f prog |
3945 |
20 Jul 20 |
peter |
119 |
$MAKE || exit_fail |
2950 |
11 Jan 13 |
peter |
120 |
test -s prog || exit_fail |
2950 |
11 Jan 13 |
peter |
121 |
exit_success |