[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Fix Makefile.svn to build APR with threads

From: Stefan Sperling <stsp_at_elego.de>
Date: Tue, 30 Nov 2010 19:52:36 +0100

On Wed, Dec 01, 2010 at 12:18:08AM +0530, Ramkumar Ramachandra wrote:
> > Your patch is too short. It's missing at least one hunk. Because if threading
> > is enabled for APR, you should also enable it for sqlite and any other
> > dependencies affected.
>
> Ok, got it. Here's my second try.
>
> [[[
> Makefile.svn: Optionally allow building with threading support
>
> * tools/dev/unix-build/Makefile.svn: Add a new ENABLE_THREADING
> variable to control whether APR and sqlite should be built with
> threading support.
> ]]]
>
>
> Index: tools/dev/unix-build/Makefile.svn
> ===================================================================
> --- tools/dev/unix-build/Makefile.svn (revision 1040658)
> +++ tools/dev/unix-build/Makefile.svn (working copy)
> @@ -3,6 +3,7 @@
> # WARNING: This may or may not work on your system. This Makefile is
> # an example, rather than a ready-made universal solution.
>
> +ENABLE_THREADING ?= no # OpenBSD doesn't have kernel threads for example

You can call this variable THREADING so it's shorter to type on the
command line.

> ENABLE_PYTHON_BINDINGS ?= yes
> ENABLE_RUBY_BINDINGS ?= yes
> ENABLE_PERL_BINDINGS ?= yes
> @@ -241,12 +242,21 @@
> | sed -e '/^.*APR_ADDTO(CPPFLAGS, \[-D_POSIX_THREADS\]).*$$/d' \
> > $(APR_SRCDIR)/build/apr_hints.m4
> cd $(APR_SRCDIR) && ./buildconf
> - cd $(APR_OBJDIR) \
> - && env CFLAGS="-O0 -g $(PROFILE_CFLAGS)" \
> - $(APR_SRCDIR)/configure \
> - --prefix=$(PREFIX)/apr \
> - --enable-maintainer-mode \
> - --disable-threads
> + if [ $(ENABLE_THREADING) = yes ]; then \
> + cd $(APR_OBJDIR) \
> + && env CFLAGS="-O0 -g $(PROFILE_CFLAGS)" \
> + $(APR_SRCDIR)/configure \
> + --prefix=$(PREFIX)/apr \
> + --enable-maintainer-mode \
> + --enable-threads; \
> + else \
> + cd $(APR_OBJDIR) \
> + && env CFLAGS="-O0 -g $(PROFILE_CFLAGS)" \
> + $(APR_SRCDIR)/configure \
> + --prefix=$(PREFIX)/apr \
> + --enable-maintainer-mode \
> + --disable-threads; \
> + fi;
> touch $@
>
> # compile apr

I would define a make variable that contains threading or non-threading
flags depending on THREADING=1, like this:

ifdef THREADING
THREADING_FLAG=--enable-threads
else
THREADING_FLAG=--enable-threads
endif

Then you can do this:
                cd $(APR_OBJDIR) \
                        && env CFLAGS="-O0 -g $(PROFILE_CFLAGS)" \
                        $(APR_SRCDIR)/configure \
                        --prefix=$(PREFIX)/apr \
                        --enable-maintainer-mode \
                        $(THREADING_FLAG); \

> @@ -706,12 +716,21 @@
>
> # configure sqlite
> $(SQLITE_OBJDIR)/.configured: $(SQLITE_OBJDIR)/.retrieved
> - cd $(SQLITE_OBJDIR) \
> - && env CFLAGS="-g $(PROFILE_CFLAGS)" \
> - $(SQLITE_SRCDIR)/configure \
> - --prefix=$(PREFIX)/sqlite \
> - --disable-tcl \
> - --disable-threadsafe
> + if [ $(ENABLE_THREADING) = yes ]; then \
> + cd $(SQLITE_OBJDIR) \
> + && env CFLAGS="-g $(PROFILE_CFLAGS)" \
> + $(SQLITE_SRCDIR)/configure \
> + --prefix=$(PREFIX)/sqlite \
> + --disable-tcl \
> + --enable-threadsafe; \
> + else \
> + cd $(SQLITE_OBJDIR) \
> + && env CFLAGS="-g $(PROFILE_CFLAGS)" \
> + $(SQLITE_SRCDIR)/configure \
> + --prefix=$(PREFIX)/sqlite \
> + --disable-tcl \
> + --disable-threadsafe; \
> + fi;
> touch $@
>
> # compile sqlite

Same here.

Stefan
Received on 2010-11-30 19:53:21 CET

This is an archived mail posted to the Subversion Dev mailing list.