Completely revamp configure so that it preserves the standard make variables CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS and LIBS by moving the configure additions to EXTRA_* variables. Also, allow the user to specify NOTEST_* values for all of the above, which eliminates the need for THREAD_CPPFLAGS, THREAD_CFLAGS, and OPTIM. Fix the setting of INCLUDES and EXTRA_INCLUDES. Check flags as they are added to avoid pointless duplications. Fix the order in which flags are given on the compile and link lines.
Make the dav/main config.m4 file be added to the configure script after httpd, and make dav default to no if http is not enabled. Dav still defaults to yes if http is in the server. Dav is incredibly HTTP centric, and makes little to no sense without HTTP