[FFmpeg-devel] [RFC][PATCH] configure: libfreetype check
Clément Bœsch
u at pkh.me
Fri Dec 6 23:25:19 CET 2013
On Fri, Dec 06, 2013 at 10:55:04PM +0100, Alexander Strasser wrote:
> Hi,
>
> this Debian bug
>
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=731015
>
> indicates that we need to extend/change our libfreetype check.
>
> I have attached 3 different approaches and hope for some
> comments now. Beware, I did not thoroughly test yet. So
> more testing welcome as well.
>
> Alexander
> From c2d17ff925c9243330ac833a6dd37b7f0c5f4abc Mon Sep 17 00:00:00 2001
> Message-Id: <c2d17ff925c9243330ac833a6dd37b7f0c5f4abc.1386362311.git.eclipse7 at gmx.net>
> From: Alexander Strasser <eclipse7 at gmx.net>
> Date: Thu, 5 Dec 2013 23:31:53 +0100
> Subject: [PATCH] configure: Use macro instead of header name in #include
>
> The freetype check is the only place where we need to include
> in-directly through a macro. Specialize check_func_headers to
> recognize that special case and omit the surrounding angle
> brackets.
>
> This change affects only to the configure detection, because
> in the drawtext filter the macro way of including the header
> is used already.
>
> Signed-off-by: Alexander Strasser <eclipse7 at gmx.net>
> ---
> configure | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index 5881e6a..39f9b20 100755
> --- a/configure
> +++ b/configure
> @@ -953,7 +953,11 @@ check_func_headers(){
> shift 2
> {
> for hdr in $headers; do
> - echo "#include <$hdr>"
> + if test "$hdr" = FT_FREETYPE_H; then
> + echo "#include $hdr"
> + else
> + echo "#include <$hdr>"
> + fi
There are other places where there is the #include test, so I don't like
very much this hack.
> done
> for func in $funcs; do
> echo "long check_$func(void) { return (long) $func; }"
> @@ -4316,7 +4320,7 @@ enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersio
> enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
> flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite"
> enabled libflite && require2 libflite "flite/flite.h" flite_init $flite_libs
> -enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
> +enabled libfreetype && require_pkg_config freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
> enabled libgme && require libgme gme/gme.h gme_new_emu -lgme -lstdc++
> enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
> check_lib "${gsm_hdr}" gsm_create -lgsm && break;
> --
> From 8696dd58570deb0f7e9dfef6327d11c3c73525c7 Mon Sep 17 00:00:00 2001
> Message-Id: <8696dd58570deb0f7e9dfef6327d11c3c73525c7.1386365701.git.eclipse7 at gmx.net>
> From: Alexander Strasser <eclipse7 at gmx.net>
> Date: Fri, 6 Dec 2013 21:20:46 +0100
> Subject: [PATCH] configure: libfreetype: Check for different header paths
>
> Some distributions have it below freetype/ directory and
> others not.
>
> The official libfreetype way to handle this is to use
> a macros instead of a string literal. That is how it is
> done in the drawtext filter and the reason this commit
> only affects configure detection.
>
> Signed-off-by: Alexander Strasser <eclipse7 at gmx.net>
> ---
> configure | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 5881e6a..d7eaa4b 100755
> --- a/configure
> +++ b/configure
> @@ -4316,7 +4316,12 @@ enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersio
> enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
> flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite"
> enabled libflite && require2 libflite "flite/flite.h" flite_init $flite_libs
> -enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
> +enabled libfreetype && { check_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType \
> + || check_pkg_config freetype2 "ft2build.h freetype.h" FT_Init_FreeType \
> + || die "ERROR: freetype2 not found"; } \
> + && { add_cflags $(get_safe ${pkg}_cflags)
> + add_extralibs $(get_safe ${pkg}_libs); }
> +
I don't like this one.
> enabled libgme && require libgme gme/gme.h gme_new_emu -lgme -lstdc++
> enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
> check_lib "${gsm_hdr}" gsm_create -lgsm && break;
> --
> From 7da78bc381d02fbf328d251843be11f32fb04ae3 Mon Sep 17 00:00:00 2001
> Message-Id: <7da78bc381d02fbf328d251843be11f32fb04ae3.1386364728.git.eclipse7 at gmx.net>
> From: Alexander Strasser <eclipse7 at gmx.net>
> Date: Fri, 6 Dec 2013 17:20:26 +0100
> Subject: [PATCH] configure: Special case libfreetype test
>
> Include the freetype header, in-directly through a macro, like it
> is done in the drawtext filter. Do not break if the header is moved,
> like it was done in at least distribution.
>
> Signed-off-by: Alexander Strasser <eclipse7 at gmx.net>
> ---
> configure | 21 ++++++++++++++++++++-
> 1 file changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 5881e6a..5606426 100755
> --- a/configure
> +++ b/configure
> @@ -1127,6 +1127,25 @@ require_pkg_config(){
> add_extralibs $(get_safe ${pkg}_libs)
> }
>
> +require_libfreetype(){
> + log check_libfreetype "$@"
> + pkg="freetype2"
> + shift 3
> + check_cmd $pkg_config --exists --print-errors $pkg || return
> + pkg_cflags=$($pkg_config --cflags $pkg)
> + pkg_libs=$($pkg_config --libs $pkg)
> + {
> + echo "#include <ft2build.h>"
> + echo "#include FT_FREETYPE_H"
> + echo "long check_func(void) { return (long) FT_Init_FreeType; }"
> + echo "int main(void) { return 0; }"
> + } | check_ld "cc" $pkg_cflags $pkg_libs && enable $funcs &&
> + set_safe ${pkg}_cflags $pkg_cflags &&
> + set_safe ${pkg}_libs $pkg_libs
> + add_cflags $(get_safe ${pkg}_cflags)
> + add_extralibs $(get_safe ${pkg}_libs)
> +}
> +
This approach looks the saner.
Also note that you need to remove one #include in the drawtext filter to
make the compilation works.
[...]
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131206/70cbdbbb/attachment.asc>
More information about the ffmpeg-devel
mailing list