aboutsummaryrefslogtreecommitdiff
path: root/test/postinstall/test_autotools.sh
blob: c3e0e60b73315264f41773e2934892de509b9928 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh

# Post-install tests with autotools/pkg-config
#
# First required argument is the installed prefix, which
# is used to set PKG_CONFIG_PATH and rpath for shared.
# Second argument is either shared (default) or static
cd $(dirname $0)
. ./common.sh
main_setup $1 $2

echo "Running post-install tests with autotools/pkg-config (${BUILD_MODE})"

if [ ${BUILD_MODE} = shared ]; then
  export PKG_CONFIG="${PKG_CONFIG:-pkg-config}"
  ENABLE_STATIC_PROJ=no
else
  export PKG_CONFIG="${PKG_CONFIG:-pkg-config} --static"
  ENABLE_STATIC_PROJ=yes
fi
echo ,${PKG_CONFIG},

export PKG_CONFIG_PATH=${prefix}/lib/pkgconfig

if [ ${BUILD_MODE} = shared ]; then
  export LDFLAGS="${LDFLAGS} -Wl,-rpath,$(pkg-config proj --variable=libdir)"
fi

autogen_configure_check_clean(){
  set -e
  aclocal
  automake --add-missing --copy --foreign
  autoconf
  ./configure --enable-static-proj=${ENABLE_STATIC_PROJ}
  make clean
  make
  set +e
  make check
  EXIT=$?
  if [ ${EXIT} -ne 0 ]; then
    cat test-suite.log
    exit ${EXIT}
  fi
  make distclean
}

echo "Testing C app"
cd c_app
autogen_configure_check_clean
cd ..

echo "Testing C++ app"
cd cpp_app
autogen_configure_check_clean
cd ..

echo "Finished running post-install tests with autotools/pkg-config (${BUILD_MODE})"