Use -Werror when running configure
Configure currently sets -Werror in SQUID_C{,XX}FLAGS. This makes it so that these flags are not used for configure tests, but are used for building squid, and this can cause different behaviours during build (e.g. with Apple's LDAP on MacOS).
This is a simple change, but the consequences can be profound and tricky to figure out, as this may cause flips in detected system features.
Opening as a draft to support discussion
I ran a quick experiment, and TL;DR: this approach is unfeasible and it will break fundamental autoconf macros such as AC_SEARCH_LIBS.
Comparing the configure script output between master and this branch, here's a telling difference:
-checking for library containing log... -lm
+checking for library containing log... no
Which is due to (from config.log):
configure:52533: gcc -o conftest -Wall -g -O2 -Werror -I/usr/include/p11-kit-1 -I/usr/include/libxml2 -g conftest.c -lm -lnsl -ldl >&5
conftest.c:366:6: error: conflicting types for built-in function 'log'; expected 'double(double)' [-Werror=builtin-declaration-mismatch]
366 | char log ();
| ^~~
conftest.c:1:1: note: 'log' is declared in header '<math.h>'
1 | /* confdefs.h */
cc1: all warnings being treated as errors
This also tells us that the approach in PR #1694 may be the only feasible one
Following up to myself: on gcc, adding -Werror -Wno-builtin-declaration-mismatch restores ./configure's ability to detect. On clang 14, this option is not supported and, in fact, not needed, configure works with -Werror.
I am however a bit concerned by adding all this tricky and necessary magic to configure, and I'd still prefer to stick to not adding -Werror during configure
Closing this PR as it has achieved its goal. Having -Werror in CFLAGS is a bad idea and we shouldn't do it. I have drafted a post for the squid wiki, there doesn't seem to be any easily-found literature online about this and it could be helpful for others to know