From ef2aa6be0b8dd385a7092ae1b055335afbe91a6b Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Sat, 19 Sep 2009 18:55:44 -0500 Subject: [svn-r17500] Bug fix and improvement. Description: Build failed when embedded-info is not enabled. Fixed. testlibinfo.sh output was ugly, did not prepare the case of embedded-info not enabled. Fixed. Also changed NOT to test test binary even if static-exec is enabled. Tested: jam (with and without embedded-info enabled). Did not test in other platforms since these were script changes that are platform independent. --- src/H5detect.c | 11 +++++++--- test/testlibinfo.sh.in | 55 ++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 55 insertions(+), 11 deletions(-) diff --git a/src/H5detect.c b/src/H5detect.c index 4dae076..d5801ef 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -508,6 +508,8 @@ sigbus_handler(int UNUSED signo) * * Purpose: insert the contents of libhdf5.settings into a file * represented by flibinfo. + * Make it an empty string if H5_HAVE_EMBEDDED_LIBINFO is not + * defined, i.e., not enabled. * * Return: void * @@ -522,6 +524,7 @@ sigbus_handler(int UNUSED signo) static void insert_libhdf5_settings(FILE *flibinfo) { +#ifdef H5_HAVE_EMBEDDED_LIBINFO FILE *fsettings; /* for files libhdf5.settings */ int inchar; int bol=0; /* indicates the beginning of a new line */ @@ -562,6 +565,10 @@ insert_libhdf5_settings(FILE *flibinfo) perror(LIBSETTINGSFNAME); exit(1); } +#else + /* print variable definition and an empty string */ + fprintf(flibinfo, "char H5libhdf5_settings[]=\"\";\n"); +#endif } @@ -670,10 +677,8 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) /*******************/\n\ \n"); -#ifdef H5_HAVE_EMBEDDED_LIBINFO - /* Generate embedded library information files */ + /* Generate embedded library information variable definition */ make_libinfo(); -#endif /* The interface initialization function */ printf("\n\ diff --git a/test/testlibinfo.sh.in b/test/testlibinfo.sh.in index df440ef..d8cd7e5 100644 --- a/test/testlibinfo.sh.in +++ b/test/testlibinfo.sh.in @@ -28,20 +28,47 @@ # 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@ -# Function definitions -CHECK_LIBINFO(){ - echo Checking file $1 - strings $1 | grep "SUMMARY OF THE HDF5 CONFIGURATION" + +# 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. @@ -59,19 +86,31 @@ h5libsettings=../src/libhdf5.settings # Check dynamic library file if built. if [ x-$Shared_Lib = x-yes ]; then CHECK_LIBINFO ${h5libdir}/libhdf5.so +else + SKIP ${h5libdir}/libhdf5.so 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. -if [ x-$Shared_Lib != x-yes -o x-$Static_exec = x-yes ]; then +# 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 -exit $? - +if [ $nerrors -gt 0 ]; then + echo "***$nerrors errors encountered***" + exit 1 +else + echo "No error encountered" + exit 0 +fi -- cgit v0.12