OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Experimental C unit test suite available for hacking


On Thu, May 24, 2018 at 12:11 PM, Micha Lenk <micha@xxxxxxxxx> wrote:
>
> On 05/24/2018 12:00 PM, Yann Ylavic wrote:
>
>> I think "core" shouldn't depend on a module (even builtin), for
>> instance ap_set_{last_modified,accept_range,content_length,...} also
>> used by the core are defined in "server/protocol.c".
>>
>> WDYT?
>
> Well, first things first. Let's first fix trunk to be buildable again on
> build systems that really only link the needed symbols and thus rely on the
> correct library order during linking.

I think this is *the* dependency issue, the order in
PROGRAM_DEPENDENCIES should make modules depend on core and not the
other way around.

With this patch, both static and shared builds work for me:

Index: Makefile.in
===================================================================
--- Makefile.in    (revision 1832123)
+++ Makefile.in    (working copy)
@@ -7,9 +7,9 @@ PROGRAM_SOURCES      = modules.c
 PROGRAM_LDADD        = buildmark.o $(HTTPD_LDFLAGS)
$(PROGRAM_DEPENDENCIES) $(HTTPD_LIBS) $(EXTRA_LIBS) $(AP_LIBS) $(LIBS)
 PROGRAM_PRELINK      = $(COMPILE) -c $(top_srcdir)/server/buildmark.c
 PROGRAM_DEPENDENCIES = \
+  $(MPM_LIB) \
+  $(BUILTIN_LIBS) \
   server/libmain.la \
-  $(BUILTIN_LIBS) \
-  $(MPM_LIB) \
   os/$(OS_DIR)/libos.la

 sbin_PROGRAMS   = $(PROGRAM_NAME)
Index: modules/http/http_etag.c
===================================================================
--- modules/http/http_etag.c    (revision 1832123)
+++ modules/http/http_etag.c    (working copy)
@@ -14,6 +14,7 @@
  * limitations under the License.
  */

+#ifdef INCLUDE_FROM_CORE
 #include "apr_strings.h"
 #include "apr_thread_proc.h"    /* for RLIMIT stuff */

@@ -218,3 +219,4 @@ AP_DECLARE(void) ap_set_etag(request_rec *r)

     apr_table_setn(r->headers_out, "ETag", etag);
 }
+#endif
Index: server/protocol.c
===================================================================
--- server/protocol.c    (revision 1832123)
+++ server/protocol.c    (working copy)
@@ -164,6 +164,9 @@ AP_DECLARE(void) ap_set_content_length(request_rec
                    apr_off_t_toa(r->pool, clength));
 }

+#define INCLUDE_FROM_CORE
+#include "../modules/http/http_etag.c"
+
 /*
  * Return the latest rational time from a request/mtime (modification time)
  * pair.  We return the mtime unless it's in the future, in which case we
_

Of course it should be a real move of the code...