m4/ax_detect_clang.m4: _AX_DETECT_CLANG_ADD_CLANG_LIB: modify LIBS not LDFLAGS
authorSven Verdoolaege <sven.verdoolaege@gmail.com>
Mon, 22 Jul 2024 13:51:55 +0000 (22 15:51 +0200)
committerSven Verdoolaege <sven.verdoolaege@gmail.com>
Sun, 28 Jul 2024 08:54:14 +0000 (28 10:54 +0200)
CLANG_LIBS was originally added to LDFLAGS in isl-0.22.1-381-gbfc3e41f33
(extract-interface: improve detection of clangEdit,
Thu Jul 9 10:16:34 2020 +0200), even though LIBS is arguably
the more appropriate variable to modify, perhaps because back then
only LDFLAGS was being saved.
Since isl-0.25-312-g55159c9cd4 (extract-interface: when linking against
libclang-cpp, check linking of LLVM libs, Fri Mar 24 18:29:53 2023 +0100),
LIBS is also being saved and modified, so it can also be updated
to add CLANG_LIBS.

Note that there is no need to add CLANG_LDFLAGS to LDFLAGS (again)
since LDFLAGS is already being updated this way before the check
for libclang-cpp.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
m4/ax_detect_clang.m4

index 66798cd..5d1c749 100644 (file)
@@ -288,8 +288,8 @@ AC_LANG_POP
 
 # Check if the specified (clang) library exists and, if so,
 # add it to CLANG_LIBS.
-# SAVE_LDFLAGS is assumed to hold the original LDFLAGS.
+# SAVE_LIBS is assumed to hold the original LIBS.
 m4_define([_AX_DETECT_CLANG_ADD_CLANG_LIB], [
-       LDFLAGS="$CLANG_LDFLAGS $CLANG_LIBS $SAVE_LDFLAGS"
+       LIBS="$CLANG_LIBS $SAVE_LIBS"
        AC_CHECK_LIB($1, [main], [CLANG_LIBS="-l$1 $CLANG_LIBS"])
 ])