Skip to content

Commit

Permalink
freetype: don't clober CFLAGS/LDFLAGS
Browse files Browse the repository at this point in the history
When detecting Freetype, don't include its own compilation information
directly in CFLAGS/LDFLAGS.  Instead, separate this out.

This fixes the case where a user could override CFLAGS as in:

    make CFLAGS="-O0 -ggdb" -j $(nproc)

yet freetype clobbers this, resulting in freetype not being detected.
  • Loading branch information
ThomasAdam committed Dec 6, 2020
1 parent 3e6eb5c commit ccfad77
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
9 changes: 7 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,8 @@ AC_ARG_ENABLE(xft,
]
)

freetype_CFLAGS=""
freetype_LIBS=""
AH_TEMPLATE([HAVE_XFT],[Define if Xft library is used.])
AH_TEMPLATE([HAVE_XFT2],[Define if Xft 2 library is used.])
AH_TEMPLATE([HAVE_XFT_UTF8],[Define if Xft library can handle utf8 encoding])
Expand All @@ -591,15 +593,18 @@ if test ! x"$with_xft" = xno; then
AC_MSG_RESULT([yes])
CFLAGS_FREETYPE=`"${PKG_CONFIG}" --cflags freetype2`
FREETYPE_LIBS=`"${PKG_CONFIG}" --libs freetype2`
CFLAGS="$CFLAGS $CFLAGS_FREETYPE"
LIBS="$LIBS $FREETYPE_LIBS"
freetype_CFLAGS="$CFLAGS_FREETYPE"
freetype_LIBS="$FREETYPE_LIBS"

have_freetype=yes
else
AC_MSG_RESULT([no])
have_freetype=no
fi

AC_SUBST(freetype_CFLAGS)
AC_SUBST(freetype_LIBS)

# check for fontconfig for Xft 2
have_fontconfig=no
if test ! x"$have_freetype" = xno ; then
Expand Down
4 changes: 2 additions & 2 deletions modules/FvwmAnimate/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ FvwmAnimate_DEPENDENCIES = $(top_builddir)/libs/libfvwm3.a
## so we might as well link against libXpm, if present.
LDADD = -L$(top_builddir)/libs $(X_LIBS) -lfvwm3 $(xpm_LIBS) \
$(X_PRE_LIBS) -lXext -lX11 $(X_EXTRA_LIBS) -lm $(png_LIBS) \
$(rsvg_LIBS) $(Xrender_LIBS) $(Xcursor_LIBS)
$(rsvg_LIBS) $(Xrender_LIBS) $(Xcursor_LIBS) $(freetype_LIBS)

AM_CPPFLAGS = -I$(top_srcdir) $(xpm_CFLAGS) $(X_CFLAGS) \
$(png_CFLAGS) $(Xrender_CFLAGS)
$(png_CFLAGS) $(Xrender_CFLAGS) $(freetype_CFLAGS)
5 changes: 3 additions & 2 deletions modules/FvwmAuto/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ FvwmAuto_SOURCES = FvwmAuto.c
FvwmAuto_DEPENDENCIES = $(top_builddir)/libs/libfvwm3.a

LDADD = -L$(top_builddir)/libs $(X_LIBS) -lfvwm3 \
$(X_PRE_LIBS) -lXext -lX11 $(X_EXTRA_LIBS) $(XRandR_LIBS)
$(X_PRE_LIBS) -lXext -lX11 $(X_EXTRA_LIBS) $(XRandR_LIBS) \
$(freetype_LIBS)

AM_CPPFLAGS = -I$(top_srcdir) $(X_CFLAGS)
AM_CPPFLAGS = -I$(top_srcdir) $(X_CFLAGS) $(freetype_CFLAGS)

4 changes: 2 additions & 2 deletions modules/FvwmBacker/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ FvwmBacker_DEPENDENCIES = $(top_builddir)/libs/libfvwm3.a

LDADD = -L$(top_builddir)/libs $(X_LIBS) -lfvwm3 \
$(X_PRE_LIBS) $(XRandR_LIBS) -lXext -lX11 -lm $(X_EXTRA_LIBS) \
$(Xrender_LIBS) $(rsvg_LIBS)
$(Xrender_LIBS) $(rsvg_LIBS) $(freetype_LIBS)

AM_CPPFLAGS = -I$(top_srcdir) $(X_CFLAGS) $(Xrender_CFLAGS)
AM_CPPFLAGS = -I$(top_srcdir) $(X_CFLAGS) $(Xrender_CFLAGS) $(freetype_CFLAGS)

4 changes: 2 additions & 2 deletions modules/FvwmEvent/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ FvwmEvent_SOURCES = FvwmEvent.c
FvwmEvent_DEPENDENCIES = $(top_builddir)/libs/libfvwm3.a

LDADD = -L$(top_builddir)/libs $(X_LIBS) -lfvwm3 \
$(X_PRE_LIBS) -lXext -lX11 $(X_EXTRA_LIBS)
$(X_PRE_LIBS) -lXext -lX11 $(X_EXTRA_LIBS) $(freetype_LIBS)

AM_CPPFLAGS = -I$(top_srcdir) $(X_CFLAGS)
AM_CPPFLAGS = -I$(top_srcdir) $(X_CFLAGS) $(freetype_CFLAGS)

0 comments on commit ccfad77

Please sign in to comment.