❦ 29 septembre 2013 18:30 CEST, Willy Tarreau <w...@1wt.eu> :

> So maybe we should in fact stop setting PCREDIR to $(pcre-config --prefix),
> which will result in PCRE_INC/PCRE_LIB remaining silent unless PCREDIR is
> forced. I suspect the following patch should fix it :
>
> diff --git a/Makefile b/Makefile
> index 0529e89..89f9f39 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -544,7 +544,6 @@ ifneq ($(USE_PCRE)$(USE_STATIC_PCRE)$(USE_PCRE_JIT),)
>  # Forcing PCREDIR to an empty string will let the compiler use the default
>  # locations.
>  
> -PCREDIR              := $(shell pcre-config --prefix 2>/dev/null || echo 
> /usr/local)
>  ifneq ($(PCREDIR),)
>  PCRE_INC     := $(PCREDIR)/include
>  PCRE_LIB     := $(PCREDIR)/lib

I would use `pcre-config --libs` and `pcre-config --cflags` instead. The
user can still override this on make command line.

PCRE_CFLAGS := $(shell pcre-config --cflags)
PCRE_LIBS := $(shell pcre-config --libs)

As for the ordering of -L, I would expect the user to specify `make
LDFLAGS="-L/tmp/openssl/static"` and you rename the internal `LDFLAGS`
to something else (instead of introducing another variable, LDFLAGS is
the variable that a user can expect to override). $(LDFLAGS) will be
used early (as currently done), so the specified directory will be first
in the search path.

This is similar to how it would work for an autoconf based build system:

haproxy_CFLAGS = @PCRE_FLAGS@
haproxy_LDADD  = @PCRE_LDFLAGS@

automake will generate something like this:

LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
        $(AM_LDFLAGS) $(LDFLAGS) -o $@
haproxy: ...
        $(AM_V_CCLD)$(LINK) $(haproxy_OBJECTS) $(haproxy_LDADD) $(LIBS)

So, the ordering would be as expected.
-- 
printk("Entering UltraSMPenguin Mode...\n");
        2.2.16 /usr/src/linux/arch/sparc64/kernel/smp.c

Reply via email to