hdf5/config
Scot Breitenfeld f6ae241032
Addresses configuration fortran testing flags (#4276)
* turn warnings to errors in fortran configure test

* Intel fortran test fix
2024-03-28 16:55:32 -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 Addresses configuration fortran testing flags (#4276) 2024-03-28 16:55:32 -05:00
cmake-presets Add NEWSLETTER and merge abi reports and add sha256sums (#4055) 2024-03-05 14:50:39 -08:00
gnu-warnings Turn on -Werror for Java in GitHub -Werror workflows (#4243) 2024-03-26 07:40:16 -05:00
intel-warnings Develop intel split (#3722) 2023-10-19 15:17:20 -07:00
sanitizer replace deprecated CMAKE_COMPILER_IS_GNU** (#4272) 2024-03-28 09:20:57 -07:00
site-specific Update copyright headers (#2184) 2022-11-01 16:02:27 -05:00
toolchain Fix some minor formatting for consistency (#3499) 2023-09-04 23:01:08 -05:00
apple Update Autotools to correctly configure oneAPI (#3751) 2023-10-23 12:50:15 -07:00
BlankForm Remove unused AIX cross-compile cache overrides (#4043) 2024-02-26 14:32:26 -06:00
cce-fflags
cce-flags
clang-cxxflags Add support for AOCC & Flang w/ the Autotools (#3674) 2023-10-14 22:39:43 -05:00
clang-fflags Add support for AOCC & Flang w/ the Autotools (#3674) 2023-10-14 22:39:43 -05:00
clang-flags Update copyright headers (#2184) 2022-11-01 16:02:27 -05:00
commence.am Removes MPE instrumentation support. (#2245) 2022-11-09 11:06:26 -08:00
conclude_fc.am Update copyright headers (#2184) 2022-11-01 16:02:27 -05:00
conclude.am Fix 'make check-vfd' target for Autotools (#4211) 2024-03-22 21:31:16 -05:00
cygwin Consolidate Autotools linux files (#4044) 2024-02-26 14:34:27 -06:00
examples.am Update copyright headers (#2184) 2022-11-01 16:02:27 -05:00
freebsd Fix build error on freebsd (#3883) 2023-12-07 08:12:25 -08:00
gnu-cxxflags Update copyright headers (#2184) 2022-11-01 16:02:27 -05:00
gnu-fflags Adds -Warray-temporaries to the developer warnings (#2385) 2023-01-03 06:18:48 -08:00
gnu-flags Update copyright headers (#2184) 2022-11-01 16:02:27 -05:00
ibm-aix Remove unused AIX cross-compile cache overrides (#4043) 2024-02-26 14:32:26 -06:00
ibm-flags Update copyright headers (#2184) 2022-11-01 16:02:27 -05:00
intel-cxxflags Don't try to load general-19 warnings file for icc (#4042) 2024-02-26 14:28:49 -06:00
intel-fflags Develop intel split (#3722) 2023-10-19 15:17:20 -07:00
intel-flags Don't try to load general-19 warnings file for icc (#4042) 2024-02-26 14:28:49 -06:00
libhdf5.fpc.in CMake generated pkg-config file is incorrect #2259 (#2476) 2023-02-17 14:17:17 -08:00
libhdf5.pc.in CMake generated pkg-config file is incorrect #2259 (#2476) 2023-02-17 14:17:17 -08:00
linux-gnu Consolidate Autotools linux files (#4044) 2024-02-26 14:34:27 -06:00
lt_vers.am Update copyright headers (#2184) 2022-11-01 16:02:27 -05:00
Makefile.am.blank Update copyright headers (#2184) 2022-11-01 16:02:27 -05:00
netbsd Update Autotools to correctly configure oneAPI (#3751) 2023-10-23 12:50:15 -07:00
nvidia-cxxflags Add NVidia compiler support and CI (#3686) 2023-10-18 12:44:42 -07:00
nvidia-fflags Add NVidia compiler support and CI (#3686) 2023-10-18 12:44:42 -07:00
nvidia-flags Set NVHPC maximum optimization level to -O1 for now (#3800) 2023-11-01 14:41:46 -05:00
oneapi-cxxflags Update Autotools to correctly configure oneAPI (#3751) 2023-10-23 12:50:15 -07:00
oneapi-fflags Update Autotools to correctly configure oneAPI (#3751) 2023-10-23 12:50:15 -07:00
oneapi-flags Update Autotools to correctly configure oneAPI (#3751) 2023-10-23 12:50:15 -07:00
pgi-cxxflags
pgi-fflags Update copyright headers (#2184) 2022-11-01 16:02:27 -05:00
pgi-flags Update copyright headers (#2184) 2022-11-01 16:02:27 -05:00
README.md Consolidate Autotools linux files (#4044) 2024-02-26 14:34:27 -06:00
solaris Update copyright headers (#2184) 2022-11-01 16:02:27 -05: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.

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!