freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] using pkg-config


From: Miles Bader
Subject: Re: [ft-devel] using pkg-config
Date: Tue, 17 Sep 2013 15:50:04 +0900

2013/9/17 Behdad Esfahbod <address@hidden>:
>> It also used to the case that pkg-config didn't handle
>> cross-compilation properly (I haven't checked this in a while), which
>> seems like it would be an issue for freetype.
>
> Works just fine for cross-compiling.  I do that every day.

It does?  How does it work?

At least with standard autoconf practices, pkg-config doesn't even
seem to notice if you're cross-compiling, and just gives info for the
cross-compilation host, which is usually incorrect...

This isn't entirely surprising, as pkg-config doesn't use the compiler
like most autoconf tests, and so won't automatically reflect changes
in the toolchain used.  The pkg-config autoconf macros could
conceivably detect this situation (and do... what, I don't know, but
they could at least disable pkg-config), but don't appear to even try.

E.g. if you use the following basic configure.ac file:

    AC_INIT([t1], [0.0], [Miles Bader <address@hidden>])
    AC_CONFIG_HEADERS([config.h])
    AC_PROG_CC
    PKG_PROG_PKG_CONFIG
    have_libpng=no
    PKG_CHECK_MODULES([libpng], [libpng], [have_libpng=yes], [:])
    if test $have_libpng = yes; then
      AC_DEFINE([HAVE_LIBPNG], [1], [Define if libpng is installed])
    fi
    AC_CONFIG_FILES([Makefile])
    AC_OUTPUT

and then try to cross-compile with it:

    ./configure --host=x86_64-w64-mingw32

... then the wrong thing will happen, and the build will fail.  By
contrast, a "traditional" library check using AC_CHECK_LIB will behave
as expected.

So at the least, it looks like some sort of special care is needed
either on the part of the configure script or on the part of the user,
to deal with pkg-config during cross-compilation.

Thanks,

-miles

-- 
Cat is power.  Cat is peace.



reply via email to

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