[svn-r16814] New feature(Bug 230):

Embed the content of libhdf5.settings into the hdf5 executables so that an
"orphaned" executables can display (via the Unix strings command, for example)
the library settings used to build the executables.

This is a prototype implementation. Much improvement is needed.

configure.in:
    Added the --disable-embedded-libinfo option to disable this feature.
configure:
src/H5config.h.in:
    Generated by autotools like automake.
src/H5detect.c:
    Implement insert_libhdf5_settings() to insert the contents of
    libhdf5.settings into the library as an extern string variable so that it
    is included in all HDF5 executable.  Much improvement is needed.
fortran/src/Makefile.in:
    Auto-generated by bin/reconfigure. (i.e., I did make any changes to cause
    its direct regeneration).

Tested:
Jam serial, using default and --disable-embedded-libinfo, configure options.
This commit is contained in:
Albert Cheng 2009-04-20 21:02:46 -05:00
parent c60f5a8429
commit 9bca9d684b
5 changed files with 139 additions and 27 deletions

78
configure vendored
View File

@ -1646,6 +1646,8 @@ Optional Features:
--enable-strict-format-checks
Enable strict file format checks, default=yes if
debug flag is enabled, no otherwise
--enable-embedded-libinfo
Enable embedded library information [default=yes]
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@ -8078,13 +8080,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
(eval echo "\"\$as_me:8081: $ac_compile\"" >&5)
(eval echo "\"\$as_me:8083: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
(eval echo "\"\$as_me:8084: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval echo "\"\$as_me:8086: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
(eval echo "\"\$as_me:8087: output\"" >&5)
(eval echo "\"\$as_me:8089: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@ -9305,7 +9307,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 9308 "configure"' > conftest.$ac_ext
echo '#line 9310 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -12176,11 +12178,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:12179: $lt_compile\"" >&5)
(eval echo "\"\$as_me:12181: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:12183: \$? = $ac_status" >&5
echo "$as_me:12185: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -12515,11 +12517,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:12518: $lt_compile\"" >&5)
(eval echo "\"\$as_me:12520: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:12522: \$? = $ac_status" >&5
echo "$as_me:12524: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -12620,11 +12622,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:12623: $lt_compile\"" >&5)
(eval echo "\"\$as_me:12625: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:12627: \$? = $ac_status" >&5
echo "$as_me:12629: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -12675,11 +12677,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:12678: $lt_compile\"" >&5)
(eval echo "\"\$as_me:12680: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:12682: \$? = $ac_status" >&5
echo "$as_me:12684: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -15511,7 +15513,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 15514 "configure"
#line 15516 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -15607,7 +15609,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 15610 "configure"
#line 15612 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -17635,11 +17637,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:17638: $lt_compile\"" >&5)
(eval echo "\"\$as_me:17640: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:17642: \$? = $ac_status" >&5
echo "$as_me:17644: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -17734,11 +17736,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:17737: $lt_compile\"" >&5)
(eval echo "\"\$as_me:17739: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:17741: \$? = $ac_status" >&5
echo "$as_me:17743: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -17786,11 +17788,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:17789: $lt_compile\"" >&5)
(eval echo "\"\$as_me:17791: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:17793: \$? = $ac_status" >&5
echo "$as_me:17795: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -19331,11 +19333,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:19334: $lt_compile\"" >&5)
(eval echo "\"\$as_me:19336: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:19338: \$? = $ac_status" >&5
echo "$as_me:19340: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -19430,11 +19432,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:19433: $lt_compile\"" >&5)
(eval echo "\"\$as_me:19435: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:19437: \$? = $ac_status" >&5
echo "$as_me:19439: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -19482,11 +19484,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:19485: $lt_compile\"" >&5)
(eval echo "\"\$as_me:19487: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:19489: \$? = $ac_status" >&5
echo "$as_me:19491: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -51236,6 +51238,30 @@ echo "${ECHO_T}no" >&6; }
esac
{ echo "$as_me:$LINENO: checking Whether to have library information embedded in the executables" >&5
echo $ECHO_N "checking Whether to have library information embedded in the executables... $ECHO_C" >&6; }
# Check whether --enable-embedded-libinfo was given.
if test "${enable_embedded_libinfo+set}" = set; then
enableval=$enable_embedded_libinfo; enable_embedded_libinfo=$enableval
else
enable_embedded_libinfo=yes
fi
if test "${enable_embedded_libinfo}" = "yes"; then
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
cat >>confdefs.h <<\_ACEOF
#define HAVE_EMBEDDED_LIBINFO 1
_ACEOF
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
{ echo "$as_me:$LINENO: checking if alignment restrictions are strictly enforced" >&5
echo $ECHO_N "checking if alignment restrictions are strictly enforced... $ECHO_C" >&6; }
if test "$cross_compiling" = yes; then

View File

@ -3795,6 +3795,25 @@ case "X-$STRICT_CHECKS" in
esac
dnl ----------------------------------------------------------------------
dnl Enable embedded library information
dnl
AC_MSG_CHECKING([Whether to have library information embedded in the executables])
AC_ARG_ENABLE([embedded-libinfo],
[AC_HELP_STRING([--enable-embedded-libinfo],
[Enable embedded library information [default=yes]])],
[enable_embedded_libinfo=$enableval],
[enable_embedded_libinfo=yes])
if test "${enable_embedded_libinfo}" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_EMBEDDED_LIBINFO], [1],
[Define if library information should be embedded in the executables])
else
AC_MSG_RESULT([no])
fi
dnl ----------------------------------------------------------------------
dnl Check if pointer alignments are enforced
dnl

View File

@ -227,7 +227,7 @@ H5Zregister(const void *cls)
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_API(H5Zregister, FAIL)
H5TRACE1("e", "*Zc", cls);
H5TRACE1("e", "*x", cls);
/* Check args */
if (cls_real==NULL)

View File

@ -84,6 +84,9 @@
/* Define to 1 if you have the <dmalloc.h> header file. */
#undef HAVE_DMALLOC_H
/* Define if library information should be embedded in the executables */
#undef HAVE_EMBEDDED_LIBINFO
/* Define to 1 if you have the <features.h> header file. */
#undef HAVE_FEATURES_H

View File

@ -108,6 +108,7 @@ static void detect_C99_integers16(void);
static void detect_C99_integers32(void);
static void detect_C99_integers64(void);
static void detect_alignments(void);
static void insert_libhdf5_settings(void);
static size_t align_g[] = {1, 2, 4, 8, 16};
static jmp_buf jbuf_g;
@ -500,6 +501,64 @@ sigbus_handler(int UNUSED signo)
#endif /* H5_HAVE_SIGLONGJMP */
}
/*-------------------------------------------------------------------------
* Function: insert_libhdf5_settings
*
* Purpose: Insert contents of libhdf5.settings so that it is included
* in all hdf5 executables.
*
* Return: void
*
* Programmer: Albert Cheng
* Apr 20, 2009
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
#define LIBSETTINGSFNAME "libhdf5.settings"
static void
insert_libhdf5_settings(void)
{
FILE *fsettings;
char inchar;
int bol=0; /* indicates the beginning of a new line */
if (NULL==(fsettings=HDfopen(LIBSETTINGSFNAME, "r"))){
perror(LIBSETTINGSFNAME);
exit(1);
}
/* print variable definition */
printf("extern char H5libhdf5_settings[]=\n");
bol++;
while (EOF != (inchar = getc(fsettings))){
if (bol){
/* Start a new line */
printf("\t\"");
bol = 0;
}
if (inchar == '\n'){
/* end of a line */
printf("\\n\"\n");
bol++;
}else{
putchar(inchar);
}
}
if (feof(fsettings)){
/* wrap up */
if (!bol){
/* EOF found without a new line */
printf("\\n\"\n");
};
printf(";\n\n");
}else{
fprintf(stderr, "Read errors encountered with %s\n", LIBSETTINGSFNAME);
exit(1);
}
}
/*-------------------------------------------------------------------------
* Function: print_results
@ -580,6 +639,11 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align)
/*******************/\n\
\n");
#ifdef H5_HAVE_EMBEDDED_LIBINFO
/* Insert content of libhdf5.settings */
insert_libhdf5_settings();
#endif
/* The interface initialization function */
printf("\n\
\n\