hdf5/test/testlibinfo.sh.in
Mike McGreevy 98362b664c [svn-r20504] Purpose:
General shared library improvements for CYGWIN / AIX

Description:

    Shared libraries are disabled on both CYGWIN and AIX due
    to inability to build them correctly. Part of the problem
    in both of these situations is the lack of the libtool
    flag -no-undefined, which tells libtool that all needed
    symbols are defined at link time (a requirement on these
    systems) and that it's okay to build shared libraries.

    Another problem are lack of dependencies between wrapper
    libraries and core C HDF5 library.

    This patch addresses both of these by fixing configure to
    add in -no-undefined flag for libtool during linking and
    adds automake dependencies in the Makefile.am files.

    After testing, both CYGWIN and AIX now generate shared
    libraries, but there are still some test failures in each.
    (cache_api, dt_arith, and testerror.sh on CYGWIN, and
    fortran tests on AIX).

    Even though the shared libraries are not quite perfect,
    this is a general improvement to what we had before, so
    I'm applying the patch anyways. Note that default behavior
    of shared libraries on these systems being disabled has
    NOT been changed and requires the use of the
    --enable-unsupported to attempt to build them.

    We will need to address the test failures in each
    architecture prior to formally supporting shared
    libraries on each.

Tested:

    h5committested & CYGWIN tested (on bangan)
    (AIX tested by Albert on bp-login2)
2011-04-14 16:21:59 -05:00

118 lines
3.1 KiB
Bash

#! /bin/sh
#
# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
# All rights reserved.
#
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the files COPYING and Copyright.html. COPYING can be found at the root
# of the source code distribution tree; Copyright.html can be found at the
# root level of an installed copy of the electronic HDF5 document set and
# is linked from the top-level documents page. It can also be found at
# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
# access to either file, you may request a copy from help@hdfgroup.org.
#
# Tests for the embedded library information feature.
# Part 1:
# Verify the HDF5 library does contains an exact copy of the content of the
# libhdf5.settings file.
# Part 2:
# If executable is linked with the static hdf5 library (how to determine?),
# verify an executable indeed contains an exact copy of hte content of the
# libhdf5.settings file.
#
# Programmer: Albert Cheng
# Sep 18, 2009
# Determine the configure options of the hdf5 library and executables.
Shared_Lib=@enable_shared@
Static_Lib=@enable_static@
Static_exec=@STATIC_EXEC@
# Print a line-line message left justified in a field of 70 characters.
#
LINEMSG() {
SPACES=" "
echo "Check file $* $SPACES" | cut -c1-70 | tr -d '\012'
}
# Print a "SKIP" message
SKIP() {
LINEMSG $*
echo " -SKIP-"
}
# Function definitions
CHECK_LIBINFO(){
LINEMSG $1
if strings $1 | grep "SUMMARY OF THE HDF5 CONFIGURATION" > /dev/null; then
echo " PASSED"
else
echo " FAILED"
nerrors=`expr $nerrors + 1`
fi
}
# MAIN Body
nerrors=0
H5_HAVE_EMBEDDED_LIBINFO=`grep '#define H5_HAVE_EMBEDDED_LIBINFO ' ../src/H5pubconf.h`
# Skip the rest if embedded-libinfo is not enabled.
if [ -z "$H5_HAVE_EMBEDDED_LIBINFO" ]; then
echo "embedded-libinfo is not enabled. Test skipped."
exit 0
fi
# The location of HDF library file(s) depends on whether shared lib is
# built too.
if [ -n $Shared_Lib ]; then
h5libdir=../src/.libs
shlib=$(grep dlname ../src/libhdf5.la | sed -e "s/dlname='//" -e "s/'//")
else
h5libdir=../src
fi
h5libsettings=../src/libhdf5.settings
# Part 1:
# Verify the HDF5 library does contains an exact copy of the content of the
# libhdf5.settings file.
# Check dynamic library file if built.
if [ x-$Shared_Lib = x-yes ]; then
CHECK_LIBINFO ${h5libdir}/${shlib}
else
SKIP shlib
fi
# Though rare, libhdf5.a may not have been built.
if [ x-$Static_Lib = x-yes ]; then
CHECK_LIBINFO ${h5libdir}/libhdf5.a
else
SKIP ${h5libdir}/libhdf5.a
fi
# Check if executables has the lib information only if shared lib is not
# built or static-exec is used. (Don't care static-exec since it affects
# tools binary only.)
if [ x-$Shared_Lib != x-yes ]; then
CHECK_LIBINFO testhdf5
else
SKIP testhdf5
fi
if [ $nerrors -gt 0 ]; then
echo "***$nerrors errors encountered***"
exit 1
else
echo "No error encountered"
exit 0
fi