]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Avoid redefining _FORTIFY_SOURCE
authorTony Finch <fanf@isc.org>
Wed, 15 Feb 2023 19:00:37 +0000 (19:00 +0000)
committerTony Finch <fanf@isc.org>
Thu, 16 Feb 2023 13:43:40 +0000 (13:43 +0000)
Some compilers have a built-in definition of the _FORTIFY_SOURCE macro
that differs from BIND's preferred setting. This causes errors like
the one quoted below. The solution is to undefine the macro before
defining it. A similar fix was recently committed to glibc.

    <command line>: error: '_FORTIFY_SOURCE' macro redefined
    #define _FORTIFY_SOURCE 2
            ^
    <built-in>: note: previous definition is here
    #define _FORTIFY_SOURCE 0
    ^

https://sourceware.org/git/glibc.git/commitdiff/35bcb08eaa953c9b

configure.ac

index 4aa1761b26df6ddd8183f2bd169b0fa4b4e52f12..c180364dfb436c90b0b33574d8cfc142a4f97a30 100644 (file)
@@ -134,8 +134,9 @@ STD_LDFLAGS=""
 # ... except in test code
 TEST_CFLAGS="-Wno-vla"
 
-# Fortify the sources by default
-STD_CPPFLAGS="-D_FORTIFY_SOURCE=2"
+# Fortify the sources by default (we undefine the macro first in case
+# the compiler has a different built-in setting)
+STD_CPPFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
 
 #
 # Additional compiler settings.