hdf5/config
Frank Berghaus 100b22e6c2
Use case-insensitive comparison for headers fix #2100 (#2101)
* Use case-inseneitive comparison for headers

HTTP headers should be case-insensitive. Use case-insensitive string
comparisons when working with HTTP header responses to ensure
compatibility.

* Revert "Use case-inseneitive comparison for headers"

This reverts commit a02f591723506b62b7208449be6eef7122120398

* Ignore case when searching HTTP header responses

Looking up the Content-Length in the header returned by S3 storage
endpoints should ignore case. To guarantee portability implement a
function for case-insensitive string search, because it is non-standard.

* Add an _ after H5 for the strcasestr implementation

It is a private function and should sport that underscore.

* Remove author comment from the doc comment

* Use search function defined by system if available

Check whether the system provides a function implementing case
insensitive string searches. Only use the custom implementation if the
system does not provide the functionality.

* Add tests for case-insensitive search

Basic tests:
  - Search for empty string
  - Search with exact match
  - Search with case-insensitive match
  - search with no match

* Enforce clang-format style

Some variable definitions in the th5_system tests did not conform to
clang-format's expectations. Updated the offending lines.

* Correct comment describing test case

* Added some spaces to please clang-format

* Ignore discarding const

Ask the compiler to ignore discarding the const when retunring a match from H5_strcasestr

Co-authored-by: Frank Berghaus <frank.berghaus@mpcdf.mpg.de>
2022-09-21 11:50:17 -05:00
..
clang-warnings Fixes for format string warnings raised by -Wformat=2/-Wformat-security (#1489) 2022-03-11 13:10:20 -06:00
cmake Use case-insensitive comparison for headers fix #2100 (#2101) 2022-09-21 11:50:17 -05:00
gnu-warnings Corrects more Fortran warnings (#2059) 2022-08-23 08:48:14 -07:00
intel-warnings Windows and *nix use different forms for warnings (#1515) 2022-03-24 08:27:29 -05:00
sanitizer Fix bug in cppcheck in tool.cmake (#1988) 2022-08-10 12:19:26 -07:00
site-specific
toolchain
apple Minor things noticed while merging to 1.10 (#1739) 2022-05-06 11:06:52 -07:00
BlankForm Minor things noticed while merging to 1.10 (#1739) 2022-05-06 11:06:52 -07:00
cce-fflags
cce-flags
clang-cxxflags
clang-flags
commence.am
conclude_fc.am Quiets Fortran Autotools builds (#2052) 2022-08-22 08:21:06 -07:00
conclude.am Replaces bin/newer with -nt comparison in Makefiles (#2020) 2022-08-17 09:21:24 -07:00
cygwin
examples.am Replaced bin/mkdirs w/ mkdir -p -m 755, which is POSIX (#2018) 2022-08-17 08:02:39 -07:00
freebsd
gnu-cxxflags Fixed Spelling Errors (#1166) 2021-12-07 08:27:29 -06:00
gnu-fflags Corrects more Fortran warnings (#2059) 2022-08-23 08:48:14 -07:00
gnu-flags Re-promote some GNU warnings to errors (#1508) 2022-05-06 16:26:48 -07:00
ibm-aix Fix typos found in the rest of the hdf5 code-base (#1985) 2022-08-10 13:57:26 -07:00
ibm-flags Fix typos found in the rest of the hdf5 code-base (#1985) 2022-08-10 13:57:26 -07:00
intel-cxxflags
intel-fflags Removed compiler messages for language elements that are not standard in Fortran 2003, #1344 (#1905) 2022-07-18 09:42:56 -07:00
intel-flags
libhdf5.fpc.in Implement improved CMake fortran module folder from GH#1411 (#1922) 2022-07-26 09:02:40 -07:00
libhdf5.pc.in
linux-gnu
linux-gnuaout
linux-gnueabihf
linux-gnulibc1
linux-gnulibc2
lt_vers.am
Makefile.am.blank
netbsd
pgi-cxxflags
pgi-fflags
pgi-flags
README.md Adds documentation for config directory (#2065) 2022-08-24 23:05:28 -07:00
solaris Fixed Spelling Errors (#1166) 2021-12-07 08:27:29 -06:00

The config directory

Intro

HDF5 can be configured using both the GNU Autotools and CMake. We try to keep them in sync, but you can expect minor differences to crop up. Please create a GitHub issue for any differences noted. Note that with the Autotools, we do NOT check generated files into GitHub until release time, so you will need to generate configure, Makefile.in(s), etc. via autogen.sh in the project root if you want to build with that system.

Configuration information for the HDF5 library and tools is (unfortunately) spread across the repository. Basic library configuration will generally be found in configure.ac (Autotools) and the root's CMakeLists.txt (CMake). Each subdirectory of the project also has its own Makefile.am or CMake build and test files.

This directory contains a few important things:

  • Autotools OS- and compiler-specific configuration
  • CMake support files (in cmake)
  • Warning files shared between the two systems (in *-warnings directories)
  • CMake toolchain files (in toolchain)
  • CMake sanitizer files (in sanitizer)

CMake will be documented elsewhere. This document focuses on the Autotools files and the shared warning files.

Autotools

An Autotools build will first use $host_cpu, $host_os, etc. to try to find a suitable platform file in config to source and start checking compilers. The code that does this is in configure.ac (search for host_os). For example, MacOS will source the apple file and FreeBSD will source the freebsd file. There are a bunch of Linux files, but they all eventually invoke linux-gnulibc1.

If you dig into one of these files, the way that they check for compilers is rather crude. Each OS script will simply source the various C, C++, and Fortran compiler files that are listed inside. Each compiler file checks the designated compiler's version output to see if there's a match, and if so, the flag processing proceeds, and a variable like cc_flags_set will be set at the end.

In case it's not obvious, the C files end in -flags, C++ in -cxxflags, and Fortran in -fflags.

When a compiler matches, the script will attempt to set the CFLAGS, etc. variables based on the platform and compiler's properties. There are typically a large number of flag categories (e.g., DEBUG_OPT_CFLAGS) that are conditionally appended to the canonical variables, like AM_FLAGS, by the remainder of the configure script.

For the major compilers, like Clang and gcc, there will be a section at the end where we append version-specific flags, mainly for warnings. These are imported via a function in the script (load_gnu_arguments() for gcc). See below for more detail.

Warnings files

Keeping the Autotools and CMake build files in sync has always been a bit of a struggle. One way that we help to ensure that the same flags are used in each build system is to import the warnings settings from text files that are maintained separately from the Autotools and CMake build files. We like to configure the compiler to be as crabby as possible so as to catch subtle bugs, so there are a LOT of warning flags for popular compilers like Clang and gcc.

We've located these files in config/*-warnings directories. Each file represents a compiler version and contains the warning flags we set, one to a line. Lines that start with # are considered comment lines. You'll also see developer and no-developer flavors of compiler version files. The former corresponds to "developer flags" that are usually either only semi-useful and/or generate a lot of (usually unfixable) noise. The latter corresponds to things that we want to ensure do NOT appear in non-developer builds of the library. These might involve a different level setting (-Wfoo=x) or something that gets incorporated in a "conglomerate" flag like -Wextra so we need to set -Wno-foo in non-developer builds. Developer warnings can be turned on via a configure option. You will also sometimes see error files. Those are files that include warnings that will be considered errors if you have enabled the "warnings as errors" configure option set. Now that the library is largely warning-free, these are less useful than in the past as you can now just set -Werror directly in many cases (our configure script is smart about not running configure checks with -Werror).

For anyone interested, we are always interested in improving both the OS and compiler files, so pull requests for those are always welcome, especially for platforms we don't have routine access to. If you are a compiler or platform expert/aficionado, please help us out!