[x264-devel] [Git][videolan/x264][master] mp4: Add GPAC detection with pkg-config

Anton Mitrofanov gitlab at videolan.org
Tue Apr 13 20:40:26 UTC 2021



Anton Mitrofanov pushed to branch master at VideoLAN / x264


Commits:
979044a6 by Anton Mitrofanov at 2021-04-13T19:20:26+00:00
mp4: Add GPAC detection with pkg-config

- - - - -


2 changed files:

- configure
- x264.c


Changes:

=====================================
configure
=====================================
@@ -124,6 +124,7 @@ cl_ldflags() {
         arg=${arg/pthreadGC/pthreadVC}
         [ "$arg" = avifil32.lib ] && arg=vfw32.lib
         [ "$arg" = gpac_static.lib ] && arg=libgpac_static.lib
+        [ "$arg" = gpac.lib ] && arg=libgpac.lib
         [ "$arg" = x264.lib ] && arg=libx264.lib
 
         [ -n "$arg" ] && echo -n "$arg "
@@ -1244,15 +1245,32 @@ fi
 
 if [ "$gpac" = "auto" -a "$lsmash" != "yes" ] ; then
     gpac="no"
-    GPAC_LIBS="-lgpac_static"
-    cc_check "" -lz && GPAC_LIBS="$GPAC_LIBS -lz"
-    cc_check "" -ldl && GPAC_LIBS="$GPAC_LIBS -ldl"
-    if [ "$SYS" = "WINDOWS" ] ; then
-        cc_check "" -lws2_32 && GPAC_LIBS="$GPAC_LIBS -lws2_32"
-        cc_check "" -lwinmm && GPAC_LIBS="$GPAC_LIBS -lwinmm"
+    if pkg_check gpac ; then
+        GPAC_LIBS_TMP="$GPAC_LIBS $($PKGCONFIG --libs gpac)"
+        GPAC_CFLAGS_TMP="$GPAC_CFLAGS $($PKGCONFIG --cflags gpac)"
+        if cc_check gpac/isomedia.h "$GPAC_CFLAGS_TMP $GPAC_LIBS_TMP" "gf_isom_close(0);" ; then
+            GPAC_LIBS="$GPAC_LIBS_TMP"
+            GPAC_CFLAGS="$GPAC_CFLAGS_TMP"
+        else
+            GPAC_LIBS_TMP="$GPAC_LIBS $($PKGCONFIG --static --libs gpac | sed 's/-lgpac //')"
+            GPAC_CFLAGS_TMP="$GPAC_CFLAGS $($PKGCONFIG --static --cflags gpac)"
+            if cc_check gpac/isomedia.h "$GPAC_CFLAGS_TMP $GPAC_LIBS_TMP" "gf_isom_close(0);" ; then
+                GPAC_LIBS="$GPAC_LIBS_TMP"
+                GPAC_CFLAGS="$GPAC_CFLAGS_TMP"
+            fi
+        fi
+    fi
+    if [ -z "$GPAC_LIBS" ] ; then
+        GPAC_LIBS="-lgpac_static"
+        cc_check "" -lz && GPAC_LIBS="$GPAC_LIBS -lz"
+        cc_check "" -ldl && GPAC_LIBS="$GPAC_LIBS -ldl"
+        if [ "$SYS" = "WINDOWS" ] ; then
+            cc_check "" -lws2_32 && GPAC_LIBS="$GPAC_LIBS -lws2_32"
+            cc_check "" -lwinmm && GPAC_LIBS="$GPAC_LIBS -lwinmm"
+        fi
     fi
-    if cc_check gpac/isomedia.h "$GPAC_LIBS" "gf_isom_close(0);" ; then
-        if cc_check gpac/isomedia.h "$GPAC_LIBS" "gf_isom_set_pixel_aspect_ratio(0,0,0,0,0,0);" ; then
+    if cc_check gpac/isomedia.h "$GPAC_CFLAGS $GPAC_LIBS" "gf_isom_close(0);" ; then
+        if cc_check gpac/isomedia.h "$GPAC_CFLAGS $GPAC_LIBS" "gf_isom_set_pixel_aspect_ratio(0,0,0,0,0,0);" ; then
             gpac="yes"
         else
             echo "Warning: gpac is too old, update to v0.8.0 or later"
@@ -1268,6 +1286,7 @@ if [ "$lsmash" = "yes" ] ; then
 elif [ "$gpac" = "yes" ] ; then
     mp4="gpac"
     LDFLAGSCLI="$GPAC_LIBS $LDFLAGSCLI"
+    CFLAGS="$CFLAGS $GPAC_CFLAGS"
     define HAVE_GPAC
 fi
 


=====================================
x264.c
=====================================
@@ -66,7 +66,7 @@
 #endif
 
 #if HAVE_GPAC
-#include <gpac/version.h>
+#include <gpac/isomedia.h>
 #endif
 
 #if HAVE_LSMASH



View it on GitLab: https://code.videolan.org/videolan/x264/-/commit/979044a6595c7d01d14bca0360f0e94bb815af70

-- 
View it on GitLab: https://code.videolan.org/videolan/x264/-/commit/979044a6595c7d01d14bca0360f0e94bb815af70
You're receiving this email because of your account on code.videolan.org.




More information about the x264-devel mailing list