I haven't done this before but since the check in configure.ac only
checks gcc and not if the source is patched to avoid the problem, I
think you have to delete/comment the check
(http://hg.code.sf.net/p/octave/image/rev/c506938a4ca6) in configure.ac
and rerun bootstrap.
Not sure what or where bootstrap is.
I built from Fedora 24 src.rpm, so I am assuming from what you say that
I have to rebuild Octave, which seems a bit at odds with the text
describing the workaround, as it only talks about a patch to the image
package on Octave Forge.
Can someone please clarify exactly what needs to be done?