diff options
author | Sam James <sam@gentoo.org> | 2023-01-09 08:04:31 +0000 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2023-01-13 13:48:49 -0600 |
commit | dc03ee1303430c3d844e24a9185426948f144bdf (patch) | |
tree | fd5c694a86e91a522eb14489d0f7a3758a922ed6 | |
parent | 70d69de70b063b20ffbeb52be0a20fa53477c89a (diff) | |
download | m4-dc03ee1303430c3d844e24a9185426948f144bdf.tar.gz |
build: Don't add _FORTIFY_SOURCE if already set by user/toolchain
Newer toolchains (GCC 12+ or Clang 9+, glibc-2.34) allow _FORTIFY_SOURCE=3.
The current macro used in configure.ac will forcefully downgrade to F_S=2
and emit a warning if the user set something else:
```
x86_64-pc-linux-gnu-gcc -DEXEEXT=\"\" -I. -I../lib -DIN_M4_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../lib -I./../lib -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -Wreturn-type -ggdb3 -Werror=implicit-function-declaration -Werror=implicit-int -c -o glthread/thread.o glthread/thread.c
In file included from glthread/thread.c:20:
../lib/config.h:202: warning: "_FORTIFY_SOURCE" redefined
202 | # define _FORTIFY_SOURCE 2
|
<built-in>: note: this is the location of the previous definition
```
See: 390d259efe8e1c7e4b6babb4738fef7427416857
Signed-off-by: Sam James <sam@gentoo.org>
Message-Id: <20230109080431.1320075-1-sam@gentoo.org>
-rw-r--r-- | configure.ac | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 864318da..671bca45 100644 --- a/configure.ac +++ b/configure.ac @@ -133,7 +133,9 @@ if test "$gl_gcc_warnings" = yes; then [/* Enable compile-time and run-time bounds-checking, and some warnings, without upsetting newer glibc. */ #if defined __OPTIMIZE__ && __OPTIMIZE__ - # define _FORTIFY_SOURCE 2 + # ifndef _FORTIFY_SOURCE + # define _FORTIFY_SOURCE 2 + # endif #endif ]) fi |