# @configure_input@ # $Id: defs.sh.in 3100 2013-11-01 08:51:28Z peter $ # Copyright (C) 2009, 2010, 2011, 2012, 2013 Peter Johansson # # This file is part of the yat library, http://dev.thep.lu.se/yat # # The yat library is free software; you can redistribute it # and/or modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # # The yat library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with yat. If not, see . # bootstrap a test project # bootstrap () { rm -rf m4 $mkdir_p m4 cp $abs_top_srcdir/m4/*.m4 m4/. rm -f m4/lt*.m4 m4/libtool.m4 res=0 autoreconf -si $verbose || res=$? case $res in 0) :;; 63) exit_skip;; *) exit $res;; esac } # Usage: run PROG EXPECTED_EXITCODE [OPTION]... run () { test $# -ge 2 || exit_fatal foo_prog=$1 shift expected_exitcode=$1 shift exitcode=0 $foo_prog ${1+"$@"} > stdout 2>stderr || exitcode=$? cat stderr >&2 cat stdout test $exitcode = $expected_exitcode || Exit 1 } Exit () { set +x; exit $1; } warn_ () { echo $@ >&2; } exit_fail () { warn_ "$me: failed test: $@"; Exit 1; } exit_fatal () { warn_ "$me: hard error: $@"; Exit 99; } exit_skip () { warn_ "$me: skipped test: $@"; Exit 77; } exit_success () { echo "$me: successsful test: $@"; Exit 0; } check_requirements () { # if required tool is not available, exit_skip if test -n "$required"; then for tool in $required; do case $tool in automake) echo "$me: running $tool --version" ($tool --version) || exit_skip; # skip test if automake older than v1.10 version_am=`$tool --version | head -n 1 | cut -f 2 -d ')'` ver_major=`echo ${version_am} | cut -f 1 -d '.'` test ${ver_major} -ge 1 || exit_skip ver_minor=`echo ${version_am} | cut -f 2 -d '.'` test ${ver_major} -gt 1 || test ${ver_minor} -ge 10 || exit_skip ;; doxygen) test @have_doxygen@ = "yes" || exit_skip no doxygen ;; libbam) test @have_libbam@ = "yes" || exit_skip no libbam ;; libmy-shared) test -r test/lib/libmy-shared.la || exit_fatal "no 'libmy-shared.la'" test -s test/lib/libmy-shared.la || exit_skip no shared lib ;; libmy-static) test -r test/lib/libmy-static.a || exit_fatal "no 'libmy-static.a'" test -s test/lib/libmy-static.a || exit_skip no static lib ;; libtool) # GNU libtool comes as glibtool on Mac OS (echo "$me: running libtool --version" && libtool --version) || \ (echo "$me: running glibtool --version" && glibtool --version) || \ exit_skip ;; shared) if (test "x@enable_shared@" = "xno"); then echo shared disabled; exit_skip; fi ;; static) if (test "x@enable_static@" = "xno"); then echo static disabled; exit_skip; fi ;; *) echo "$me: running $tool --version" ($tool --version) || exit_skip esac done fi } me=$0 # some defs we need in tests test_dir=`echo $me.dir | sed -e 's,.*[\\/],,'` test_dir="test/testSubDir/$test_dir" abs_top_builddir=@abs_top_builddir@ abs_top_srcdir=@abs_top_srcdir@ have_doxygen="@have_doxygen@" mkdir_p="@MKDIR_P@ --verbose" verbose="--verbose" silent= GSL_CONFIG=@GSL_CONFIG@ # user is always right test -z "$DOXYGEN" && DOXYGEN="@DOXYGEN@" VERSION="@VERSION@"