branch development updated: libtool: Check if -no-canonical-prefixes supported

Ileana Dumitrescu <[email protected]>
Newsgroups gmane.comp.gnu.libtool.cvs
Message-ID <[email protected]>
This is an automated email from the git hooks/post-receive script.

ildumi pushed a commit to branch development
in repository libtool.

The following commit(s) were added to refs/heads/development by this push:
     new e40ba04a libtool: Check if -no-canonical-prefixes supported
e40ba04a is described below

commit e40ba04af725eb49db6d61471a4804efe682e423
Author: Ileana Dumitrescu <[email protected]>
AuthorDate: Fri Jun 7 20:02:55 2024 +0300

    libtool: Check if -no-canonical-prefixes supported
    
    The compiler fails with the -no-canonical-prefixes flag in certain
    environments. Check if the flag is supported in the current environment
    and skip the test if it is not supported.
    
    * tests/bug_62343.at: Skip test if -no-canonical-prefixes is unsupported
      in the current environment.
---
 tests/bug_62343.at | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/tests/bug_62343.at b/tests/bug_62343.at
index 05839dc4..f6053dc6 100644
--- a/tests/bug_62343.at
+++ b/tests/bug_62343.at
@@ -29,13 +29,32 @@ AT_CHECK([$LIBTOOL --config | $EGREP '^build_libtool_libs=no' && (exit 77)], 1)
 
 AT_DATA([x.cpp],
 [[
-void f(int *p) { *p = 21; }
+#include <iostream>
+
+int main() {
+    std::cout << "Hello, World!" << std::endl;
+    return 0;
+}
 ]])
 
+# The -no-canonical-prefixes flag sometimes fails at the compiler level
+# depending on how the environment is set up, or which other flags have to be passed.
+# So first try to compile without libtool first to test if the current environment
+# supports the -no-canonical-prefixes flag. If it doesn't, skip the test.
+
+g++ -no-canonical-prefixes -c x.cpp
+
+result=$?
 
-AT_CHECK([$LIBTOOL --mode=compile --tag=CXX g++ -c x.cpp], [0], [stdout], [stderr])
+if test 0 -ne "$result"; then
+    AT_SKIP_IF([:])
+fi
+
+AT_CHECK([$LIBTOOL --mode=compile --tag=CXX g++ -no-canonical-prefixes -c x.cpp], [0], [stdout], [stderr])
+
+AT_CHECK([$GREP -- '-no-canonical-prefixes' stdout], [0], [ignore])
 
-AT_CHECK([$LIBTOOL --mode=link --tag=CXX g++ -o libx.la -no-canonical-prefixes -rpath /usr/lib64/ x.lo], [0], [stdout], [stderr])
+AT_CHECK([$LIBTOOL --mode=link --tag=CXX g++ -no-undefined -no-canonical-prefixes -o libx.la -rpath /usr/lib64/ x.lo], [0], [stdout], [stderr])
 
 AT_CHECK([$GREP -- '-no-canonical-prefixes' stdout], [0], [ignore])
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.