automake
[Top][All Lists]
Advanced

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

Per-object *FLAGS or workaround?


From: Lars Hecking
Subject: Per-object *FLAGS or workaround?
Date: Sun, 27 Oct 2002 14:56:18 +0000
User-agent: Mutt/1.5.1i

 Having a bit of a problem on OpenBSD.

 I have a package that uses libpng, libfreetype (2.x), and jpeg library.
 freetype 2.x is part of XFree86 and lives under /usr/X11R6, but some
 packages in ports require libfreetype 1.x, which is also installed
 (/usr/local).

 Now, depending on the order of png/jpeg/freetype checks in configure,
 either the freetype 1.x or 2.x are picked up at compile time. E.g.

 found png -> CPPFLAGS = "$CPPFLAGS -I/usr/local/include"
 found freetype 2.x -> CPPFLAGS = "$CPPFLAGS -I/usr/X11R6/include/freetype2"
 found jpeg -> CPPFLAGS = "$CPPFLAGS -I/usr/local/include"

 and then at compile time, freetype 1.x includes are picked up, which is
 wrong. (LDFLAGS doesn't matter, because the libs have different names -
 lifttf in 1.x, libfreetype in 2.x).

 One solution I could think of is to take the generic .c.o and .c.lo rules
 (inference rules), write them down explicitly for the object files that
 need libfreetype headers, replace the COMPILE/LTCOMPILE macros, and add
 some AC_SUBST'ed variable to make sure that the correct include path
 is picked up:

foo.o: foo.c
#       if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
#         -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
#       then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
#       else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
#       fi
        source='$<' object='$@' libtool=no \
        depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
        $(CCDEPMODE) $(depcomp) \
        $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(libfreetype_INCLUDES) \
        $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) \
         -c `test -f '$<' || echo '$(srcdir)/'`$<

 (and same for .c.lo), but I can't say I like this because of the additional
 maintenance burden. Per-object INCLUDES/CPPFLAGS would be the optimum
 solution IMHO, but I can see how they could be very hard to implement.

 Does anyone have any better suggestions?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]