Skip to content

Commit

Permalink
Fix pkg-config invocation during cross-compilation
Browse files Browse the repository at this point in the history
Move `AC_CHECK_PROGS(PKG_CONFIG,...)` to the top level to avoid multiple
unneeded calls.

Also, honour system locations for `--with-sdl` and `--with-ffmpeg`

Closes #4152
  • Loading branch information
aol-nnov committed Nov 14, 2024
1 parent 4a8d180 commit 3fa5704
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 109 deletions.
152 changes: 51 additions & 101 deletions aconfigure
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,6 @@ ac_openh264_ldflags
ac_openh264_cflags
ac_v4l2_ldflags
ac_v4l2_cflags
PKG_CONFIG
SAVED_PKG_CONFIG_PATH
ac_ffmpeg_ldflags
ac_ffmpeg_cflags
Expand Down Expand Up @@ -744,6 +743,7 @@ ac_linux_poll
ac_os_objs
ac_std_cpp_lib
ac_target_arch
PKG_CONFIG
ac_cross_compile
ac_shlib_suffix
ac_cflags
Expand Down Expand Up @@ -5255,6 +5255,54 @@ then :

fi

for ac_prog in $host_cpu-$host_os-pkg-config $host-pkg-config pkg-config "python pkgconfig.py"
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_prog_PKG_CONFIG+y}
then :
printf %s "(cached) " >&6
else $as_nop
if test -n "$PKG_CONFIG"; then
ac_cv_prog_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_PKG_CONFIG="$ac_prog"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS

fi
fi
PKG_CONFIG=$ac_cv_prog_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
printf "%s\n" "$PKG_CONFIG" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi


test -n "$PKG_CONFIG" && break
done
test -n "$PKG_CONFIG" || PKG_CONFIG="none"


# Check whether --enable-libuuid was given.
if test ${enable_libuuid+y}
Expand Down Expand Up @@ -8153,7 +8201,7 @@ printf "%s\n" "Checking if SDL is disabled... yes" >&6; }

else $as_nop

if test "x$with_sdl" != "xno" -a "x$with_sdl" != "x"; then
if test "x$with_sdl" != "xyes" -a "x$with_sdl" != "xno" -a "x$with_sdl" != "x"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using SDL prefix... $with_sdl" >&5
printf "%s\n" "Using SDL prefix... $with_sdl" >&6; }
for ac_prog in sdl2-config sdl-config
Expand Down Expand Up @@ -8315,62 +8363,13 @@ else $as_nop
FFMPEG_PREFIX=""

SAVED_PKG_CONFIG_PATH=$PKG_CONFIG_PATH
if test "x$with_ffmpeg" != "xno" -a "x$with_ffmpeg" != "x"; then
if test "x$with_ffmpeg" != "xyes" -a "x$with_ffmpeg" != "xno" -a "x$with_ffmpeg" != "x"; then
FFMPEG_PREFIX=$with_ffmpeg
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using ffmpeg prefix... $FFMPEG_PREFIX" >&5
printf "%s\n" "Using ffmpeg prefix... $FFMPEG_PREFIX" >&6; }
export PKG_CONFIG_PATH=$FFMPEG_PREFIX/lib/pkgconfig
fi

for ac_prog in pkg-config "python pkgconfig.py"
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_prog_PKG_CONFIG+y}
then :
printf %s "(cached) " >&6
else $as_nop
if test -n "$PKG_CONFIG"; then
ac_cv_prog_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_PKG_CONFIG="$ac_prog"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS

fi
fi
PKG_CONFIG=$ac_cv_prog_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
printf "%s\n" "$PKG_CONFIG" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi


test -n "$PKG_CONFIG" && break
done
test -n "$PKG_CONFIG" || PKG_CONFIG="none"


if test "$PKG_CONFIG" != "none"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking ffmpeg packages" >&5
printf %s "checking ffmpeg packages... " >&6; }
Expand Down Expand Up @@ -9687,55 +9686,6 @@ printf "%s\n" "** OpenSSL libraries not found **" >&6; }
printf "%s\n" "Using GnuTLS prefix... $with_gnutls" >&6; }
fi

for ac_prog in $host-pkg-config pkg-config "python pkgconfig.py"
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_prog_PKG_CONFIG+y}
then :
printf %s "(cached) " >&6
else $as_nop
if test -n "$PKG_CONFIG"; then
ac_cv_prog_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_PKG_CONFIG="$ac_prog"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS

fi
fi
PKG_CONFIG=$ac_cv_prog_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
printf "%s\n" "$PKG_CONFIG" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi


test -n "$PKG_CONFIG" && break
done
test -n "$PKG_CONFIG" || PKG_CONFIG="none"


{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: checking for GnuTLS installations.." >&5
printf "%s\n" "checking for GnuTLS installations.." >&6; }

Expand Down
11 changes: 3 additions & 8 deletions aconfigure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ AC_CHECK_LIB(winmm,puts)
AC_CHECK_LIB(socket,puts)
AC_CHECK_LIB(rt,puts)
AC_CHECK_LIB(m,sin)
AC_CHECK_PROGS(PKG_CONFIG,$host_cpu-$host_os-pkg-config $host-pkg-config pkg-config "python pkgconfig.py",none)

dnl
dnl libuuid
Expand Down Expand Up @@ -1528,7 +1529,7 @@ AC_ARG_ENABLE(sdl,
fi
],
[
if test "x$with_sdl" != "xno" -a "x$with_sdl" != "x"; then
if test "x$with_sdl" != "xyes" -a "x$with_sdl" != "xno" -a "x$with_sdl" != "x"; then
AC_MSG_RESULT([Using SDL prefix... $with_sdl])
AC_PATH_PROGS(SDL_CONFIG,sdl2-config sdl-config,,$with_sdl/bin)
else
Expand Down Expand Up @@ -1579,14 +1580,12 @@ AC_ARG_ENABLE(ffmpeg,
FFMPEG_PREFIX=""
AC_SUBST(SAVED_PKG_CONFIG_PATH)
SAVED_PKG_CONFIG_PATH=$PKG_CONFIG_PATH
if test "x$with_ffmpeg" != "xno" -a "x$with_ffmpeg" != "x"; then
if test "x$with_ffmpeg" != "xyes" -a "x$with_ffmpeg" != "xno" -a "x$with_ffmpeg" != "x"; then
FFMPEG_PREFIX=$with_ffmpeg
AC_MSG_RESULT([Using ffmpeg prefix... $FFMPEG_PREFIX])
export PKG_CONFIG_PATH=$FFMPEG_PREFIX/lib/pkgconfig
fi

AC_CHECK_PROGS(PKG_CONFIG,pkg-config "python pkgconfig.py",none)

if test "$PKG_CONFIG" != "none"; then
AC_MSG_CHECKING([ffmpeg packages])
av_pkg=""
Expand Down Expand Up @@ -2240,10 +2239,6 @@ AC_ARG_ENABLE(ssl,
AC_MSG_RESULT([Using GnuTLS prefix... $with_gnutls])
fi

AC_CHECK_PROGS(PKG_CONFIG,
$host-pkg-config pkg-config "python pkgconfig.py",
none)

AC_MSG_RESULT([checking for GnuTLS installations..])
AC_SUBST(gnutls_h_present)
AC_SUBST(libgnutls_present)
Expand Down

0 comments on commit 3fa5704

Please sign in to comment.