diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2009-04-20 23:03:40 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2009-04-20 23:03:40 (GMT) |
commit | bdb33e7c9880c61acc47bb0ea5bb3b0586f3c1ad (patch) | |
tree | 2b93c065dd8f024f5a3f312d62879bd1efe9f1f2 | |
parent | cd48d93298414e48d8aa5dc3dbd2c2701b152e2c (diff) | |
download | hdf5-bdb33e7c9880c61acc47bb0ea5bb3b0586f3c1ad.zip hdf5-bdb33e7c9880c61acc47bb0ea5bb3b0586f3c1ad.tar.gz hdf5-bdb33e7c9880c61acc47bb0ea5bb3b0586f3c1ad.tar.bz2 |
[svn-r16813] 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.
-rwxr-xr-x | configure | 78 | ||||
-rw-r--r-- | configure.in | 19 | ||||
-rw-r--r-- | fortran/src/Makefile.in | 2 | ||||
-rw-r--r-- | src/H5config.h.in | 3 | ||||
-rw-r--r-- | src/H5detect.c | 64 |
5 files changed, 139 insertions, 27 deletions
@@ -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] @@ -8075,13 +8077,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:8078: $ac_compile\"" >&5) + (eval echo "\"\$as_me:8080: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:8081: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:8083: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:8084: output\"" >&5) + (eval echo "\"\$as_me:8086: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -9302,7 +9304,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 9305 "configure"' > conftest.$ac_ext + echo '#line 9307 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -12174,11 +12176,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:12177: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12179: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12181: \$? = $ac_status" >&5 + echo "$as_me:12183: \$? = $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. @@ -12513,11 +12515,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:12516: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12518: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12520: \$? = $ac_status" >&5 + echo "$as_me:12522: \$? = $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. @@ -12618,11 +12620,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:12621: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12623: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12625: \$? = $ac_status" >&5 + echo "$as_me:12627: \$? = $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 @@ -12673,11 +12675,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:12676: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12678: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12680: \$? = $ac_status" >&5 + echo "$as_me:12682: \$? = $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 @@ -15509,7 +15511,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 15512 "configure" +#line 15514 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15605,7 +15607,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 15608 "configure" +#line 15610 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -17633,11 +17635,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:17636: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17638: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17640: \$? = $ac_status" >&5 + echo "$as_me:17642: \$? = $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. @@ -17732,11 +17734,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:17735: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17737: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17739: \$? = $ac_status" >&5 + echo "$as_me:17741: \$? = $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 @@ -17784,11 +17786,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:17787: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17789: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17791: \$? = $ac_status" >&5 + echo "$as_me:17793: \$? = $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 @@ -19329,11 +19331,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:19332: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19334: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:19336: \$? = $ac_status" >&5 + echo "$as_me:19338: \$? = $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. @@ -19428,11 +19430,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:19431: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19433: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:19435: \$? = $ac_status" >&5 + echo "$as_me:19437: \$? = $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 @@ -19480,11 +19482,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:19483: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19485: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:19487: \$? = $ac_status" >&5 + echo "$as_me:19489: \$? = $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 @@ -51245,6 +51247,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 diff --git a/configure.in b/configure.in index 95703e1..abaa92a 100644 --- a/configure.in +++ b/configure.in @@ -3806,6 +3806,25 @@ 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 AC_MSG_CHECKING([if alignment restrictions are strictly enforced]) diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index 5b80fa0..9dcc4a5 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -389,7 +389,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 29 +LT_VERS_REVISION = 1 LT_VERS_AGE = 0 # Include src directory in both Fortran and C flags (C compiler is used diff --git a/src/H5config.h.in b/src/H5config.h.in index 1c70790..a3e879b 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -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 diff --git a/src/H5detect.c b/src/H5detect.c index b67c2b0..146750c 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -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; @@ -502,6 +503,64 @@ sigbus_handler(int UNUSED signo) /*------------------------------------------------------------------------- + * 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 * * Purpose: Prints information about the detected data types. @@ -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\ |