diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2010-04-01 21:00:24 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2010-04-01 21:00:24 (GMT) |
commit | 2b8896eea1636e62ee6cbdd8bc6344b18c704566 (patch) | |
tree | ede9c9f3b3ed85f0637342a51757b41589dd228e | |
parent | e8fd06c497faebc344ff2648b65f2f5debeff7f9 (diff) | |
download | hdf5-2b8896eea1636e62ee6cbdd8bc6344b18c704566.zip hdf5-2b8896eea1636e62ee6cbdd8bc6344b18c704566.tar.gz hdf5-2b8896eea1636e62ee6cbdd8bc6344b18c704566.tar.bz2 |
[svn-r18493] Bug fix:
Testlibinfo.sh failed again.
Solution:
Removed the const from H5libhdf5_settings definition, again.
Revamp the whole setting so that H5lib_settings.c is compiled
individually, just like H5Tinit.c. Hope this will take care
of the problem once for all.
Tested:
Amani using --disable-shared with --enable and --disable-embedded-libinfo.
Will test this on the AIX platform after commit (cannot run bin/reconfigure
in the AIX platform and it is too clumsy to try to ssh files back and forth
and incurred "svn merge inconsistency" later too.
Pretty confident this fix should work in all other platforms.
-rw-r--r-- | src/H5.c | 1 | ||||
-rw-r--r-- | src/H5detect.c | 1 | ||||
-rw-r--r-- | src/H5make_libsettings.c | 150 | ||||
-rwxr-xr-x | src/Makefile.am | 12 | ||||
-rw-r--r-- | src/Makefile.in | 27 |
5 files changed, 102 insertions, 89 deletions
@@ -56,7 +56,6 @@ static void H5_debug_mask(const char*); /*********************/ /* Package Variables */ /*********************/ -#include "H5lib_settings.c" /* Embedded library information */ /*****************************/ diff --git a/src/H5detect.c b/src/H5detect.c index 8fc1690..50b36fd 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -108,7 +108,6 @@ 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(FILE *flibinfo); static size_t align_g[] = {1, 2, 4, 8, 16}; static jmp_buf jbuf_g; diff --git a/src/H5make_libsettings.c b/src/H5make_libsettings.c index f91e61e..d903592 100644 --- a/src/H5make_libsettings.c +++ b/src/H5make_libsettings.c @@ -35,11 +35,12 @@ static const char *FileHeader = "\n\ * 17 Mar 2010 * Quincey Koziol * - * Purpose: Generate the H5libsettings.h header file from the + * Purpose: Generate the H5libsettings.c file from the * libhdf5.settings file. * *------------------------------------------------------------------------- */ + #include <stdio.h> #include <time.h> #include "H5private.h" @@ -68,45 +69,46 @@ 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 */ + int bol = 0; /* indicates the beginning of a new line */ + + if(NULL == (fsettings = HDfopen(LIBSETTINGSFNAME, "r"))) { + HDperror(LIBSETTINGSFNAME); + HDexit(1); + } /* end if */ - if (NULL==(fsettings=HDfopen(LIBSETTINGSFNAME, "r"))){ - perror(LIBSETTINGSFNAME); - exit(1); - } /* print variable definition and the string */ /* Do not use const else AIX strings does not show it. */ fprintf(flibinfo, "char H5libhdf5_settings[]=\n"); bol++; - while (EOF != (inchar = getc(fsettings))){ - if (bol){ + while(EOF != (inchar = HDgetc(fsettings))) { + if(bol) { /* Start a new line */ fprintf(flibinfo, "\t\""); bol = 0; - } - if (inchar == '\n'){ + } /* end if */ + if(inchar == '\n') { /* end of a line */ fprintf(flibinfo, "\\n\"\n"); bol++; - }else{ - putc(inchar, flibinfo); - } - } - if (feof(fsettings)){ + } /* end if */ + else + HDputc(inchar, flibinfo); + } /* end while */ + if(feof(fsettings)) { /* wrap up */ - if (!bol){ + if(!bol) /* EOF found without a new line */ fprintf(flibinfo, "\\n\"\n"); - }; fprintf(flibinfo, ";\n\n"); - }else{ + } /* end if */ + else { fprintf(stderr, "Read errors encountered with %s\n", LIBSETTINGSFNAME); - exit(1); - } - if (0 != fclose(fsettings)){ - perror(LIBSETTINGSFNAME); - exit(1); - } + HDexit(1); + } /* end else */ + if(0 != HDfclose(fsettings)) { + HDperror(LIBSETTINGSFNAME); + HDexit(1); + } /* end if */ #else /* print variable definition and an empty string */ /* Do not use const else AIX strings does not show it. */ @@ -140,7 +142,7 @@ make_libinfo(void) /*------------------------------------------------------------------------- * Function: print_header * - * Purpose: Prints the C file header for the generated file. + * Purpose: Prints the header for the generated file. * * Return: void * @@ -148,15 +150,13 @@ make_libinfo(void) * matzke@llnl.gov * Mar 12 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static void print_header(void) { - time_t now = time(NULL); - struct tm *tm = localtime(&now); + time_t now = HDtime(NULL); + struct tm *tm = HDlocaltime(&now); char real_name[30]; char host_name[256]; int i; @@ -181,18 +181,20 @@ information about the library build configuration\n"; { size_t n; char *comma; - if ((pwd = getpwuid(getuid()))) { - if ((comma = strchr(pwd->pw_gecos, ','))) { - n = MIN(sizeof(real_name)-1, (unsigned)(comma-pwd->pw_gecos)); - strncpy(real_name, pwd->pw_gecos, n); + + if((pwd = HDgetpwuid(getuid()))) { + if((comma = HDstrchr(pwd->pw_gecos, ','))) { + n = MIN(sizeof(real_name) - 1, (unsigned)(comma - pwd->pw_gecos)); + HDstrncpy(real_name, pwd->pw_gecos, n); real_name[n] = '\0'; - } else { - strncpy(real_name, pwd->pw_gecos, sizeof(real_name)); + } /* end if */ + else { + HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name)); real_name[sizeof(real_name) - 1] = '\0'; - } - } else { + } /* end else */ + } /* end if */ + else real_name[0] = '\0'; - } } #else real_name[0] = '\0'; @@ -202,9 +204,8 @@ information about the library build configuration\n"; * The FQDM of this host or the empty string. */ #ifdef H5_HAVE_GETHOSTNAME - if (gethostname(host_name, sizeof(host_name)) < 0) { + if(gethostname(host_name, sizeof(host_name)) < 0) host_name[0] = '\0'; - } #else host_name[0] = '\0'; #endif @@ -213,34 +214,59 @@ information about the library build configuration\n"; * The file header: warning, copyright notice, build information. */ printf("/* Generated automatically by H5make_libsettings -- do not edit */\n\n\n"); - puts(FileHeader); /*the copyright notice--see top of this file */ + HDputs(FileHeader); /*the copyright notice--see top of this file */ printf(" *\n * Created:\t\t%s %2d, %4d\n", month_name[tm->tm_mon], tm->tm_mday, 1900 + tm->tm_year); - if (pwd || real_name[0] || host_name[0]) { + if(pwd || real_name[0] || host_name[0]) { printf(" *\t\t\t"); - if (real_name[0]) printf("%s <", real_name); + if(real_name[0]) + printf("%s <", real_name); #ifdef H5_HAVE_GETPWUID - if (pwd) fputs(pwd->pw_name, stdout); + if(pwd) + HDfputs(pwd->pw_name, stdout); #endif - if (host_name[0]) printf("@%s", host_name); - if (real_name[0]) printf(">"); - putchar('\n'); - } + if(host_name[0]) + printf("@%s", host_name); + if(real_name[0]) + printf(">"); + HDputchar('\n'); + } /* end if */ printf(" *\n * Purpose:\t\t"); - for (s = purpose; *s; s++) { - putchar(*s); - if ('\n' == *s && s[1]) printf(" *\t\t\t"); - } + for(s = purpose; *s; s++) { + HDputchar(*s); + if('\n' == *s && s[1]) + printf(" *\t\t\t"); + } /* end for */ printf(" *\n * Modifications:\n *\n"); printf(" *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n"); printf(" *\tIt was generated by code in `H5make_libsettings.c'.\n"); printf(" *\n *"); - for (i = 0; i < 73; i++) putchar('-'); + for(i = 0; i < 73; i++) + HDputchar('-'); printf("\n */\n\n"); +} + +/*------------------------------------------------------------------------- + * Function: print_footer + * + * Purpose: Prints the file footer for the generated file. + * + * Return: void + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Mar 31 2010 + * + *------------------------------------------------------------------------- + */ +static void +print_footer(void) +{ + /* nothing */ } @@ -253,28 +279,20 @@ information about the library build configuration\n"; * * Failure: exit(1) * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 12, 1996 - * - * Modifications: - * Albert Cheng, 2004/05/20 - * Some compilers, e.g., Intel C v7.0, took a long time to compile - * with optimization when a module routine contains many code lines. - * Divide up all those types detections macros into subroutines, both - * to avoid the compiler optimization error and cleaner codes. + * Programmer: Albert Cheng + * 2010/4/1 * *------------------------------------------------------------------------- */ int main(void) { - print_header(); /* Generate embedded library information variable definition */ make_libinfo(); - return 0; -} + print_footer(); + HDexit(0); +} diff --git a/src/Makefile.am b/src/Makefile.am index f370c98..56104df 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -35,7 +35,7 @@ lib_LTLIBRARIES=libhdf5.la # Add libtool numbers to the HDF5 library (from config/lt_vers.am) libhdf5_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS) -# H5Tinit.c is a generated file, and should be cleaned. +# H5Tinit.c and H5lib_settings.c are generated files and should be cleaned. MOSTLYCLEANFILES=H5Tinit.c H5lib_settings.c # H5pubconf.h is generated by configure, and should be cleaned. DISTCLEANFILES=H5pubconf.h @@ -67,7 +67,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \ H5HG.c H5HGcache.c H5HGdbg.c \ H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c \ - H5HP.c H5I.c H5L.c H5Lexternal.c \ + H5HP.c H5I.c H5L.c H5Lexternal.c H5lib_settings.c \ H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \ H5MM.c H5MP.c H5MPtest.c \ H5O.c H5Oainfo.c H5Oalloc.c H5Oattr.c \ @@ -125,21 +125,19 @@ settings_DATA=libhdf5.settings H5Tinit.c: H5detect$(EXEEXT) LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) | \ sed -e 's/-L/:/g' -e 's/ //g'`" \ - $(RUNSERIAL) ./H5detect$(EXEEXT) > H5Tinit.c || \ + $(RUNSERIAL) ./H5detect$(EXEEXT) > $@ || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ ($(RM) $@ ; exit 1) -H5.o H5.lo: H5lib_settings.c - # Build configuration header file generation # The LD_LIBRARY_PATH setting is a kludge. # Things should have been all set during H5make_libsettings making. -# Remove the generated .h file if errors occur unless HDF5_Make_Ignore +# Remove the generated .c file if errors occur unless HDF5_Make_Ignore # is set to ignore the error. H5lib_settings.c: H5make_libsettings$(EXEEXT) libhdf5.settings LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) | \ sed -e 's/-L/:/g' -e 's/ //g'`" \ - $(RUNSERIAL) ./H5make_libsettings$(EXEEXT) > H5lib_settings.c || \ + $(RUNSERIAL) ./H5make_libsettings$(EXEEXT) > $@ || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ ($(RM) $@ ; exit 1) diff --git a/src/Makefile.in b/src/Makefile.in index d21cb87..1cbe182 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -119,13 +119,13 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \ H5HFman.lo H5HFsection.lo H5HFspace.lo H5HFstat.lo H5HFtest.lo \ H5HFtiny.lo H5HG.lo H5HGcache.lo H5HGdbg.lo H5HL.lo \ H5HLcache.lo H5HLdbg.lo H5HLint.lo H5HP.lo H5I.lo H5L.lo \ - H5Lexternal.lo H5MF.lo H5MFaggr.lo H5MFdbg.lo H5MFsection.lo \ - H5MM.lo H5MP.lo H5MPtest.lo H5O.lo H5Oainfo.lo H5Oalloc.lo \ - H5Oattr.lo H5Oattribute.lo H5Obogus.lo H5Obtreek.lo \ - H5Ocache.lo H5Ocont.lo H5Ocopy.lo H5Odbg.lo H5Odrvinfo.lo \ - H5Odtype.lo H5Oefl.lo H5Ofill.lo H5Oginfo.lo H5Olayout.lo \ - H5Olinfo.lo H5Olink.lo H5Omessage.lo H5Omtime.lo H5Oname.lo \ - H5Onull.lo H5Opline.lo H5Orefcount.lo H5Osdspace.lo \ + H5Lexternal.lo H5lib_settings.lo H5MF.lo H5MFaggr.lo \ + H5MFdbg.lo H5MFsection.lo H5MM.lo H5MP.lo H5MPtest.lo H5O.lo \ + H5Oainfo.lo H5Oalloc.lo H5Oattr.lo H5Oattribute.lo H5Obogus.lo \ + H5Obtreek.lo H5Ocache.lo H5Ocont.lo H5Ocopy.lo H5Odbg.lo \ + H5Odrvinfo.lo H5Odtype.lo H5Oefl.lo H5Ofill.lo H5Oginfo.lo \ + H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omessage.lo H5Omtime.lo \ + H5Oname.lo H5Onull.lo H5Opline.lo H5Orefcount.lo H5Osdspace.lo \ H5Oshared.lo H5Ostab.lo H5Oshmesg.lo H5Otest.lo H5Ounknown.lo \ H5P.lo H5Pacpl.lo H5Pdapl.lo H5Pdcpl.lo H5Pdeprec.lo \ H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo H5Pfmpl.lo H5Pgcpl.lo \ @@ -449,7 +449,7 @@ lib_LTLIBRARIES = libhdf5.la # Add libtool numbers to the HDF5 library (from config/lt_vers.am) libhdf5_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS) -# H5Tinit.c is a generated file, and should be cleaned. +# H5Tinit.c and H5lib_settings.c are generated files and should be cleaned. MOSTLYCLEANFILES = H5Tinit.c H5lib_settings.c # H5pubconf.h is generated by configure, and should be cleaned. DISTCLEANFILES = H5pubconf.h @@ -481,7 +481,7 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \ H5HG.c H5HGcache.c H5HGdbg.c \ H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c \ - H5HP.c H5I.c H5L.c H5Lexternal.c \ + H5HP.c H5I.c H5L.c H5Lexternal.c H5lib_settings.c \ H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \ H5MM.c H5MP.c H5MPtest.c \ H5O.c H5Oainfo.c H5Oalloc.c H5Oattr.c \ @@ -887,6 +887,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5checksum.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5dbg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5detect-H5detect.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5lib_settings.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5make_libsettings.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5system.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5timer.Plo@am__quote@ @@ -1215,21 +1216,19 @@ help: H5Tinit.c: H5detect$(EXEEXT) LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) | \ sed -e 's/-L/:/g' -e 's/ //g'`" \ - $(RUNSERIAL) ./H5detect$(EXEEXT) > H5Tinit.c || \ + $(RUNSERIAL) ./H5detect$(EXEEXT) > $@ || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ ($(RM) $@ ; exit 1) -H5.o H5.lo: H5lib_settings.c - # Build configuration header file generation # The LD_LIBRARY_PATH setting is a kludge. # Things should have been all set during H5make_libsettings making. -# Remove the generated .h file if errors occur unless HDF5_Make_Ignore +# Remove the generated .c file if errors occur unless HDF5_Make_Ignore # is set to ignore the error. H5lib_settings.c: H5make_libsettings$(EXEEXT) libhdf5.settings LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) | \ sed -e 's/-L/:/g' -e 's/ //g'`" \ - $(RUNSERIAL) ./H5make_libsettings$(EXEEXT) > H5lib_settings.c || \ + $(RUNSERIAL) ./H5make_libsettings$(EXEEXT) > $@ || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ ($(RM) $@ ; exit 1) |