Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions config-scripts/cups-compiler.m4
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,13 @@ AS_IF([test -n "$GCC"], [
AS_IF([test x$enable_sanitizer = xyes], [
# Use -fsanitize=address with debugging...
OPTIM="$OPTIM -g -fsanitize=address"
], [echo "$CXXFLAGS $CFLAGS" | grep -q _FORTIFY_SOURCE], [
# Don't add _FORTIFY_SOURCE if it is already there
], [
# Otherwise use the Fortify enhancements to catch any unbounded
# string operations...
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=2"
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=3"
CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=3"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to look for presence of _FORTIFY_SOURCE in the flags and then skipping addition if it's already present? That way the flag won't end up overriding distribution flags.

])

# Default optimization options...
Expand Down
9 changes: 7 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -8098,12 +8098,17 @@ then :
# Use -fsanitize=address with debugging...
OPTIM="$OPTIM -g -fsanitize=address"

elif echo "$CXXFLAGS $CFLAGS" | grep -q _FORTIFY_SOURCE
then :

# Don't add _FORTIFY_SOURCE if it is already there

else $as_nop

# Otherwise use the Fortify enhancements to catch any unbounded
# string operations...
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=2"
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=3"
CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=3"

fi

Expand Down