diff mbox series

[FFmpeg-devel,1/1] configure: use require_pkg_config to check for wavpack

Message ID 20200920115243.1554009-1-bernd.kuhls@t-online.de
State New
Headers show
Series [FFmpeg-devel,1/1] configure: use require_pkg_config to check for wavpack
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Bernd Kuhls Sept. 20, 2020, 11:52 a.m. UTC
Fixes static builds with toolchains needing "-lm" for math functions.

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Carl Eugen Hoyos Sept. 20, 2020, 12:33 p.m. UTC | #1
> Am 20.09.2020 um 13:52 schrieb Bernd Kuhls <bernd.kuhls@t-online.de>:
> 
> Fixes static builds with toolchains needing "-lm" for math functions.

Please don’t.

Why is this necessary? Doesn’t every FFmpeg link command contain -lm?

Carl Eugen
Jan Ekström Sept. 20, 2020, 12:51 p.m. UTC | #2
On Sun, Sep 20, 2020 at 3:34 PM Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>
>
>
>
>
> > Am 20.09.2020 um 13:52 schrieb Bernd Kuhls <bernd.kuhls@t-online.de>:
> >
> > Fixes static builds with toolchains needing "-lm" for math functions.
>
> Please don’t.
>

Please reword this in another way if your meaning is to note that
you'd like the configure option to still work without pkg-config.

I find pkg-config (or its less glib-dependant reimplementation,
pkgconf) to be great helpers, esp. when coupled with
PKG_CONFIG_{PATH,LIBDIR} (PATH appends, LIBDIR overrides) if you have
a custom prefix. So in my opinion the more pkg-config enabled checks
the better.

> Why is this necessary? Doesn’t every FFmpeg link command contain -lm?
>

"-lm" is only utilized in host_extralibs (and disabled in Haiku,
apparently), which is only utilized in `ffbuild/common.mak`. So when
you are doing configure checks you are going to be missing all of the
usual flags that you have not specifically specified in each and every
check.

That said, there is also a `libm` check_lib check which most likely
exports `libm_extralibs` as its result. It seems to be also utilized
in various checks where pkg-config is not utilized and the math
library was found to be required as part of the check.

Jan

Jan
James Almer Sept. 20, 2020, 2:01 p.m. UTC | #3
On 9/20/2020 8:52 AM, Bernd Kuhls wrote:
> Fixes static builds with toolchains needing "-lm" for math functions.
> 
> Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 5d68695192..4e6c6edd30 100755
> --- a/configure
> +++ b/configure
> @@ -6438,7 +6438,7 @@ enabled libvpx            && {
>      fi
>  }
>  
> -enabled libwavpack        && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput  -lwavpack
> +enabled libwavpack        && require_pkg_config libwavpack wavpack "wavpack/wavpack.h" WavpackOpenFileOutput

For the sake of not breaking compilation with incomplete build
environments, add the pkg_config check while keeping the old check as a
fallback with the addition of $libm_extralibs after -lwavpack, which
should include -lm when present.

This means doing { check_pkg_config ... || require ... }, like with
libsmbclient.

>  enabled libwebp           && {
>      enabled libwebp_encoder      && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
>      enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
>
Timo Rothenpieler Sept. 20, 2020, 2:34 p.m. UTC | #4
Consider just not using libwavpack at all.
The ffmpeg native wavpack code has more features.

There even is a patch on this list for its removal.
diff mbox series

Patch

diff --git a/configure b/configure
index 5d68695192..4e6c6edd30 100755
--- a/configure
+++ b/configure
@@ -6438,7 +6438,7 @@  enabled libvpx            && {
     fi
 }
 
-enabled libwavpack        && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput  -lwavpack
+enabled libwavpack        && require_pkg_config libwavpack wavpack "wavpack/wavpack.h" WavpackOpenFileOutput
 enabled libwebp           && {
     enabled libwebp_encoder      && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
     enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }