| # bug_62343.at -- bug 62343 -*- Autotest -*- | |
| # Copyright (C) 2024 Free Software Foundation, Inc. | |
| # | |
| # This file is part of GNU Libtool. | |
| # | |
| # GNU Libtool is free software; you can redistribute it and/or | |
| # modify it under the terms of the GNU General Public License as | |
| # published by the Free Software Foundation; either version 2 of | |
| # the License, or (at your option) any later version. | |
| # | |
| # GNU Libtool is distributed in the hope that it will be useful, | |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| # GNU General Public License for more details. | |
| # | |
| # You should have received a copy of the GNU General Public License | |
| # along with GNU Libtool. If not, see <https://www.gnu.org/licenses/>. | |
| #### | |
| AT_BANNER([Testing bug 62343:]) | |
| AT_SETUP([Use -no-canonical-prefixes flag]) | |
| AT_CHECK([$LIBTOOL --config | $EGREP '^build_libtool_libs=no' && (exit 77)], 1) | |
| AT_DATA([x.cpp], | |
| [[ | |
| #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. | |
| $CXX -no-canonical-prefixes -c x.cpp | |
| result=$? | |
| if test 0 -ne "$result"; then | |
| AT_SKIP_IF([:]) | |
| fi | |
| AT_CHECK([$LIBTOOL --mode=compile --tag=CXX $CXX -no-canonical-prefixes -c x.cpp], [0], [stdout], [stderr]) | |
| AT_CHECK([$GREP -- '-no-canonical-prefixes' stdout], [0], [ignore]) | |
| host_flags=: | |
| case $host_os in | |
| cygwin* | mingw* | windows*) | |
| host_flags=-no-undefined | |
| ;; | |
| *) | |
| ;; | |
| esac | |
| AT_CHECK([$LIBTOOL --mode=link --tag=CXX $CXX -no-canonical-prefixes $host_flags -o libx.la -rpath /usr/lib64/ x.lo], [0], [stdout], [stderr]) | |
| AT_CHECK([$GREP -- '-no-canonical-prefixes' stdout], [0], [ignore]) | |
| AT_CLEANUP |