diff options
author | Tomek Mrugalski <tomek@isc.org> | 2021-07-26 11:57:16 +0200 |
---|---|---|
committer | Tomek Mrugalski <tomek@isc.org> | 2021-07-26 12:17:04 +0200 |
commit | 0572f16e45e5c68b087dc3db45230948935fcf41 (patch) | |
tree | cabff1ae265c7c380ba3a5923f6fcc8f53ebeb23 /m4macros | |
parent | [#1077] Fixed *_LIBS variables (diff) | |
download | kea-0572f16e45e5c68b087dc3db45230948935fcf41.tar.xz kea-0572f16e45e5c68b087dc3db45230948935fcf41.zip |
[#1077] 2 out of 3 --with-libyang modes work:
- --with-libyang=/usr/local works
- --with-libyang works
- --with-libyang=/path/to/.pc does not work yet
Diffstat (limited to 'm4macros')
-rw-r--r-- | m4macros/ax_find_library.m4 | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/m4macros/ax_find_library.m4 b/m4macros/ax_find_library.m4 index 66d73571b8..f137a01247 100644 --- a/m4macros/ax_find_library.m4 +++ b/m4macros/ax_find_library.m4 @@ -40,9 +40,16 @@ AC_DEFUN([AX_FIND_LIBRARY], [ # User has pointed --with-library to a directory. # Let's try to find a library.pc first inside that directory. library_pc="${with_library}/lib/pkgconfig/${library}.pc" + if test -f "${library_pc}"; then if test -n "${PKG_CONFIG}"; then - if "${PKG_CONFIG}" "${library_pc}"; then + # The check was inadequate. We need to run pkg-config with the actual .pc file and use it. Otherwise + # pkg-config always returns 1 (invalid usage), regardless if the file exists or not. Let's use a flag + # that should work everywhere (--modversion asks for package version). We don't care about the version + # at this stage, just want to make sure the .pc file is not garbage. + ignore_me=$("${PKG_CONFIG}" --modversion "${library_pc}") + exit_code=$? + if test "${exit_code}" -eq 0; then AX_FIND_LIBRARY_WITH_PKG_CONFIG("${library_pc}", ["${list_of_variables}"], ["${pkg_config_paths}"]) else AC_MSG_WARN(["pkg-config ${library_pc}" doesn't work properly. It seems like a bad pkg-config file.]) @@ -143,7 +150,9 @@ AC_DEFUN([AX_FIND_LIBRARY_WITH_PKG_CONFIG], [ # Check that we have pkg-config installed on the system. if test -n "${PKG_CONFIG}"; then # Check that pkg-config is able to interpret the file. - if "${PKG_CONFIG}" "${library_pc_or_name}"; then + ignore_me=$("${PKG_CONFIG}" --modversion "${library_pc}") + exit_code=$? + if test "${exit_code}" -eq 0; then # Save the previous PKG_CONFIG_PATH. save_pkg_config_path="${PKG_CONFIG_PATH}" |