My first plan was to hack away the check for an argument
I think that would be a bad idea. Ripping out the test for a value will not remove the code's dependence on said value.
Configure scripts are generated using the GNU autotools. Because they are automatically generated, they're not always human-friendly to read. I've spent some time struggling with one or two in the past. So I'll offer some insight (such as it's worth), but I make no guarantees...
First, understand what the configure script is doing. Basically, the configure script doesn't trust you, the user. If you specify an option for a feature, it will run a minimal test to verify the feature-support exists on the system. The vast majority
of the code you pasted is precisely that: the configure script using "here" documents to create very small C programs that use a known serf library call, trying to compile that small program, and checking the return/exit code of the compiler.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
signifies the beginning of this process: create code, compile, check compile result.
Almost everything above that line deals with the serf options to the configure script.
Now, if you want to just go rip out the conditional, then modify these lines:
if test "$withval" = "yes" ; then
as_fn_error $? "--with-serf requires an argument." "$LINENO" 5
elif test "$withval" != "no" ; then
Delete everything in blue. For example:
if test "$withval" != "no" ; then
The code after that conditional creates a loop looking for a header named "serf.h"
It would seem to me that if would be easiest for you to do:
find / -type f -name "serf.h"
To find out where the serf library header file(s) are installed. If it's not in /usr/include or /usr/local/include you certainly won't be able to avoid giving the configure script an argument with its location.