[FFmpeg-devel] [RFC][PATCH] configure: libfreetype check

Alexander Strasser eclipse7 at gmx.net
Sat Dec 7 23:14:12 CET 2013


On 2013-12-07 11:41 +0100, Alexander Strasser wrote:
> On 2013-12-07 01:12 +0100, Alexander Strasser wrote:
> > On 2013-12-06 23:25 +0100, Clément Bœsch wrote:
> > > On Fri, Dec 06, 2013 at 10:55:04PM +0100, Alexander Strasser wrote:
[all patches skipped]
> > > 
> > > This approach looks the saner.
> > > 
> > > Also note that you need to remove one #include in the drawtext filter to
> > > make the compilation works.
> > 
> >   Yeah, I got a notice about that. The inlcude can just be deleted,
> > I think it was wrong to begin with. But to be sure I will check the
> > history of that file.
> 
>   Checked it. Was already wrong in the initial commit.
> 
>   So if I hear no more comments, I will go with variant 3 + removal
> of the wrong #include in vf_drawtext. I am planning to commit tomorrow
> evening CET at latest. Maybe earlier; I do not like to leave build
> problems like this open for too long, it hinders all the builders that
> enable libfreetype and have a version with the headers moved.
> 
>   Variant 3 was also favored by one person on IRC.

  I somehow managed to lose the error exit (=> die) when implementing
the third approach. Added that now and also included the deletion of
the freetype/... header in vf_drawtext.

  New patch attached.

  Alexander
-------------- next part --------------
From 2f1335271265071aa2e8e3ffa11833506d105411 Mon Sep 17 00:00:00 2001
Message-Id: <2f1335271265071aa2e8e3ffa11833506d105411.1386453871.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.

Unfortunately the drawtext filter included the file where the include
macros are defined in a wrong way. This is not needed and breaks the
build. Remove that #include line too.

Signed-off-by: Alexander Strasser <eclipse7 at gmx.net>
---
 configure                 | 23 ++++++++++++++++++++++-
 libavfilter/vf_drawtext.c |  1 -
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 5881e6a..f78ddfc 100755
--- a/configure
+++ b/configure
@@ -1127,6 +1127,27 @@ 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 \
+      || die "ERROR: $pkg not found"
+    add_cflags    $(get_safe ${pkg}_cflags)
+    add_extralibs $(get_safe ${pkg}_libs)
+}
+
 hostcc_o(){
     eval printf '%s\\n' $HOSTCC_O
 }
@@ -4316,7 +4337,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_libfreetype
 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;
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index dde3b0a..91b8218 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -48,7 +48,6 @@
 #include "video.h"
 
 #include <ft2build.h>
-#include <freetype/config/ftheader.h>
 #include FT_FREETYPE_H
 #include FT_GLYPH_H
 #if CONFIG_FONTCONFIG
-- 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131207/fa3c631a/attachment.asc>


More information about the ffmpeg-devel mailing list