diff options
author | Gabriel Scherer <gabriel.scherer@gmail.com> | 2023-04-18 20:40:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-18 20:40:54 +0200 |
commit | 2725f0802d60a9a18fd64f319e92f307862680fc (patch) | |
tree | 406bb620697c8893cb39e365c9fddba84a13dbb0 | |
parent | 250c12c478fb69af40e3c5f0662356271754a89b (diff) | |
parent | bc9c87de23625690d0bdd4085f7b04483d48b332 (diff) | |
download | ocaml-2725f0802d60a9a18fd64f319e92f307862680fc.tar.gz |
Merge pull request #12190 from shindere/fix-zstd-support-detection
Take host into account when looking for pkg-config
-rwxr-xr-x | configure | 118 | ||||
-rw-r--r-- | configure.ac | 10 |
2 files changed, 120 insertions, 8 deletions
@@ -723,6 +723,7 @@ PTHREAD_LIBS PTHREAD_CXX PTHREAD_CC ax_pthread_config +PKG_CONFIG rlwrap DIRECT_LD INSTALL_DATA @@ -18013,19 +18014,128 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; 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_path_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + 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 + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_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 + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_ac_pt_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + 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 + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + + ## ZSTD compression library zstd_status="" if test x"$with_zstd" != "xno" then : # Try pkg-config first, as it gives the most reliable results - if pkg-config libzstd 2>/dev/null + if ${PKG_CONFIG} libzstd 2>/dev/null then : # Now check the version - if pkg-config --atleast-version 1.4 libzstd + if ${PKG_CONFIG} --atleast-version 1.4 libzstd then : - zstd_libs=`pkg-config --libs libzstd` - zstd_flags=`pkg-config --cflags libzstd` + zstd_libs=`${PKG_CONFIG} --libs libzstd` + zstd_flags=`${PKG_CONFIG} --cflags libzstd` zstd_status="ok" else $as_nop zstd_status="zstd library too old: version 1.4 or later is needed" diff --git a/configure.ac b/configure.ac index 32c5f703e6..5973e93c01 100644 --- a/configure.ac +++ b/configure.ac @@ -1950,16 +1950,18 @@ AC_LINK_IFELSE( AC_DEFINE([HAS_BSD_GETAFFINITY_NP])], [AC_MSG_RESULT([pthread_getaffinity_np not found])])]) +AC_PATH_TOOL([PKG_CONFIG], [pkg-config], [false]) + ## ZSTD compression library zstd_status="" AS_IF([test x"$with_zstd" != "xno"], # Try pkg-config first, as it gives the most reliable results - AS_IF([pkg-config libzstd 2>/dev/null], + AS_IF([${PKG_CONFIG} libzstd 2>/dev/null], # Now check the version - [AS_IF([pkg-config --atleast-version 1.4 libzstd], - [zstd_libs=`pkg-config --libs libzstd` - zstd_flags=`pkg-config --cflags libzstd` + [AS_IF([${PKG_CONFIG} --atleast-version 1.4 libzstd], + [zstd_libs=`${PKG_CONFIG} --libs libzstd` + zstd_flags=`${PKG_CONFIG} --cflags libzstd` zstd_status="ok"], [zstd_status="zstd library too old: version 1.4 or later is needed"])], # Otherwise, try to find zstd the old way, |