[FFmpeg-devel] [PATCH] Fix pkg-config detection when using a cross-prefix

Michael Niedermayer michaelni at gmx.at
Fri Jul 6 18:36:29 CEST 2012

On Fri, Jul 06, 2012 at 12:33:16AM -0400, Kyle Schwarz wrote:
> On 7/5/2012 4:19 PM, Michael Niedermayer wrote:
> >On Thu, Jul 05, 2012 at 08:33:58PM +0200, Reimar Döffinger wrote:
> >>On Thu, Jul 05, 2012 at 12:33:33PM +0200, Michael Niedermayer wrote:
> >>>>>If you want to use the native pkg-config as a fallback then the
> >>>>>code you add should check that PKG_CONFIG_LIBDIR is set. If if its not
> >>>>>set it shouldnt use the native pkg-config
> >>>>
> >>>>So only fall back if PKG_CONFIG_LIBDIR is not set?
> >>>
> >>>if PKG_CONFIG_LIBDIR is set and no prefixed pkg-config is found then
> >>>the hosts could probably be used safely otherwise no pkg-config
> >>>should be used.
> >>>above is IMHO and from a quick look at things, its not tested ...
> >>
> >>As someone else pointed out: If we ever start using pkg-config to detect
> >>host libraries (e.g. because we need them to calculate some hardcoded
> >>tables at compile time) we will be breaking that feature badly.
> >>It might be better to document a better solution (creating a script
> >>that acts as a cross-pkg-config) and make sure its easy to find from
> >>configure.
> >
> >>Another alternative is that we try creating such a script on the fly,
> >>if it's possible to guess a suitable PKG_CONFIG_LIBDIR...
> >
> >this is a great idea, actually i dont think a script is needed,
> >configure just needs to set the PKG_CONFIG_LIBDIR (and maybe others)
> >before calling the host pkg_config for the target and reset it
> >afterwards
> So would that eliminate the use of a prefixed pkg-config completely?
> I know MinGW uses a prefixed pkg-config with it's native compiler.

I think what should be done is
if cross compilation:
1. check for prefixed pkg-config, if found use it
2. check for host pkg-config && user set path, if both use hosts
   and setup pathes before each use and reset after
3. dont use pkg-config

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120706/bacdfe92/attachment.asc>

More information about the ffmpeg-devel mailing list