On 2/16/21 9:08 PM Manolo wrote:
> Albrecht: Here is the result of my test of patch pango.diff. It doesn't
> work :=(
Yep, that's what I expected (with the patch as-is). See below why.
> I tested on macOS to try something different than another Debian-based
> Linux.
>
> rm configure
> [biomp2:~/Documents/fltk/fltk-git] % patch -p1<pango.diff
> patching file
configure.ac
> [biomp2:~/Documents/fltk/fltk-git] % autoconf -f
> [biomp2:~/Documents/fltk/fltk-git] % ./configure --enable-x11 --enable-pango
That's good so far
> configure: * * * '--enable-pango' : using system-defaults * * *
This shows that it uses the "fallback" (using system-defaults).
> configure: * * * LIBS = -lpangoxft-1.0 -lpangoft2-1.0
> -lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lcairo
> -lXft -lfontconfig -lXinerama -pthread -lpthread -lX11 * * *
The LIBS variable (above) and CXXFLAGS (below) ...
> configure: * * * CXXFLAGS = -I/opt/sw/include
> -I/opt/sw/include/freetype2 -I/opt/X11/include
> -mmacosx-version-min=10.9 -D_LIBCPP_HAS_THREAD_API_PTHREAD
> -I/usr/X11/include * * *
are taken from the hardcoded values in
configure.ac determined by the
host type:
AC_MSG_NOTICE([* * * '--enable-pango' : using system-defaults * * *])
AS_CASE([$host_os], [darwin*], [
dnl make sure LDFLAGS is appropriate for cairo (and Pango)
LDFLAGS="$($PKGCONFIG --libs cairo) $LDFLAGS"
], [linux*], [
CXXFLAGS="-I/usr/include/pango-1.0 -I/usr/include/fribidi
-I/usr/include/harfbuzz -I/usr/include/cairo $CXXFLAGS"
CXXFLAGS="-I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1
$CXXFLAGS"
], [freebsd*], [
CXXFLAGS="-I/usr/local/include/pango-1.0
-I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include $CXXFLAGS"
], [netbsd*], [
CXXFLAGS="-I/usr/pkg/include/pango-1.0 -I/usr/pkg/include/glib-2.0
-I/usr/pkg/lib/glib-2.0/include $CXXFLAGS"
CXXFLAGS="-I/usr/pkg/include/glib/glib-2.0 $CXXFLAGS"
PANGOLIBDIR="-L/usr/pkg/lib"
LDFLAGS="-Wl,-rpath,/usr/pkg/lib $LDFLAGS"
])
LIBS="$PANGOLIBDIR -lpangoxft-1.0 -lpangoft2-1.0 -lpangocairo-1.0
-lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lcairo $LIBS"
It appears that your build triggers case %host_os = darwin* which would
not set CXXFLAGS (!) and use pkg-config for "--libs cairo".
That's what I predicted to fail because the hardcoded values of flags
and libs can't work.
> Here is the output of pango-related pkg-config commands on the same system :
>
> [biomp2:~/Documents/fltk/fltk-git] % pkg-config --libs pangoxft pangocairo
> -L/opt/sw/lib -L/opt/X11/lib -lpangoxft-1.0 -lpangoft2-1.0 -lfreetype
> -lfontconfig -lXft -lpangox-1.0 -lX11 -lpangocairo-1.0 -lpango-1.0
> -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -lcairo
>
> [biomp2:~/Documents/fltk/fltk-git] % pkg-config --cflags pangoxft pangocairo
> -I/opt/sw/include/pango-1.0 -I/opt/sw/include
> -I/opt/sw/include/pango-1.0 -I/opt/sw/include/glib-2.0
> -I/opt/sw/lib/glib-2.0/include -I/opt/sw/include/cairo -I/opt/sw/include
> -I/opt/sw/include/freetype2 -I/opt/X11/include
Thanks for this info.
That said, I wrote in my previous message:
"""
Line 1095/96:
# AS_IF([test x$PKGCONFIG != x], [
AS_IF([test x$PKGCONFIG = xxx], [
The first (original) line is commented out, the second line *disables*
the path where pkg-config is used. You can re-enable the first part by
just moving the '#' to the other line.
"""
So, after we saw that the fallback with hardcoded flags and libs does
NOT work, can you please edit these two lines above, moving '# ' down
one line so the first line is enabled and pkg-config will be used. This
ought to work. Hopefully. Can you please verify?
To be clear: this would be the "normal" patch. The one you tested was
modified to demonstrate the "fallback" code which I assumed would not
work (and did not work for my Linux build before I modified the flags
and libs so they returned the same as pkg-config). Sorry for the confusion.
A note to autoconf syntax, as far as I know (only the basics):
The main principle is that strings are quoted with [string], not
"string" or 'string'.
Many macros use syntax like:
AS_IF([condition], [then ...], [else...])
or similar
AS_CASE([$host_os], [darwin*], [code for darwin],
[linux*], [code for linux],
[freebsd*], [...]
[...])
These macros can be nested like this:
AC_CHECK_HEADERS([pango/pango.h pango/pangoxft.h], [
AC_CHECK_LIB([pango-1.0], [pango_layout_new], [
AC_CHECK_LIB([pangoxft-1.0], [pango_xft_render_layout], [
AC_DEFINE([USE_PANGO])
pango_found=yes
])
])
])
The effect is that the instruction part
AC_DEFINE([USE_PANGO])
pango_found=yes
is executed only if all conditions in the lines before are true.