From 7fdd21054366fde6eb8f0bf0a2fe540fd38140d4 Mon Sep 17 00:00:00 2001 From: Joseph Heenan Date: Sun, 29 May 2016 11:08:36 +0100 Subject: [PATCH 1/2] Produce more helpful error if pkg-config not installed Currently if users run autoreconf then configure without having pkg-config installed, they see: ./configure: line 5283: syntax error near unexpected token FFMPEG,' ./configure: line 5283: PKG_CHECK_MODULES(FFMPEG, libavutil libavformat libavcodec libswscale, HAVE_FFMPEG=yes)' This is not hugely helpful and causes support queries and confusion. It is because the pkg.m4 file that defines PKG_CHECK_MODULES is not available of pkg-config is not installed. To work around this, remove PKG_CHECK_MODULES and do roughly the equivalent calling pkg-config directly. To mirror the current behaviour, we also add a test for pkg-config being present and abort if it is not. (I am not 100% sure this is the desired behaviour, but regardless this commit is still an improvement on what we currently have.) --- configure.ac | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 155c12cc..900051ef 100644 --- a/configure.ac +++ b/configure.ac @@ -383,7 +383,19 @@ AS_IF([test "x$with_ffmpeg" != "xno"], [ PKG_CONFIG_PATH=${with_ffmpeg}/lib/pkgconfig:$PKG_CONFIG_PATH export PKG_CONFIG_PATH ]) - PKG_CHECK_MODULES([FFMPEG], libavutil libavformat libavcodec libswscale, HAVE_FFMPEG=yes) + + AC_CHECK_PROG([PKGCONFIG],[pkg-config],[yes],[no]) + AM_CONDITIONAL([FOUND_PKGCONFIG], [test "x$PKGCONFIG" = xyes]) + AM_COND_IF([FOUND_PKGCONFIG],,[AC_MSG_ERROR([required package 'pkg-config' not found, please check motion_guide.html and install necessary dependencies.])]) + + AC_SUBST(FFMPEG_LIBS) + AC_SUBST(FFMPEG_CFLAGS) + FFMPEG_DEPS="libavutil libavformat libavcodec libswscale" + if pkg-config $FFMPEG_DEPS; then + FFMPEG_CFLAGS=`pkg-config --cflags $FFMPEG_DEPS` + FFMPEG_LIBS=`pkg-config --libs $FFMPEG_DEPS` + HAVE_FFMPEG="yes" + fi ]) AS_IF([test "${HAVE_FFMPEG}" = "yes" ], [ From 55945b6d7d8f91258f1467198a437ec394be1000 Mon Sep 17 00:00:00 2001 From: Mr-DaveDev Date: Thu, 18 Aug 2016 21:23:58 -0600 Subject: [PATCH 2/2] Updated configure.ac for pkg-config --- CHANGELOG | 1 + configure.ac | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 40219cc8..09a9b046 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,5 @@ Summary of Changes + * Better messages for pkg-config * Fix timelapse crash when selecting mpeg4 Version 3.4.1 Changes Below * Added suggestion for including pkgconf as part of build requirements diff --git a/configure.ac b/configure.ac index 900051ef..a256f3d4 100644 --- a/configure.ac +++ b/configure.ac @@ -368,6 +368,14 @@ if test x$JPEG_SUPPORT != xyes ; then ) fi +# +# Check for the pkg-config. +# + +AC_CHECK_PROG([PKGCONFIG],[pkg-config],[yes],[no]) +AM_CONDITIONAL([FOUND_PKGCONFIG], [test "x$PKGCONFIG" = xyes]) +AM_COND_IF([FOUND_PKGCONFIG],,[AC_MSG_ERROR([Required package 'pkg-config' not found, please check motion_guide.html and install necessary dependencies.])]) + # # Check for libavcodec and libavformat from ffmpeg @@ -384,10 +392,6 @@ AS_IF([test "x$with_ffmpeg" != "xno"], [ export PKG_CONFIG_PATH ]) - AC_CHECK_PROG([PKGCONFIG],[pkg-config],[yes],[no]) - AM_CONDITIONAL([FOUND_PKGCONFIG], [test "x$PKGCONFIG" = xyes]) - AM_COND_IF([FOUND_PKGCONFIG],,[AC_MSG_ERROR([required package 'pkg-config' not found, please check motion_guide.html and install necessary dependencies.])]) - AC_SUBST(FFMPEG_LIBS) AC_SUBST(FFMPEG_CFLAGS) FFMPEG_DEPS="libavutil libavformat libavcodec libswscale" @@ -395,6 +399,8 @@ AS_IF([test "x$with_ffmpeg" != "xno"], [ FFMPEG_CFLAGS=`pkg-config --cflags $FFMPEG_DEPS` FFMPEG_LIBS=`pkg-config --libs $FFMPEG_DEPS` HAVE_FFMPEG="yes" + else + AC_MSG_ERROR([Required ffmpeg packages 'libavutil-dev libavformat-dev libavcodec-dev libswscale-dev' were not found. Please check motion_guide.html and install necessary dependencies or use the '--without-ffmpeg' configuration option.]) fi ])