ltmain.in: Use func_warning for all warnings
[libtool.git] / tests / deplibs-mingw.at
blob72a176269a057ca9f9dc6f96a34e9fe599275d97
1 # deplibs-mingw.at --                         -*- Autotest -*-
3 #   Copyright (C) 2010-2019, 2021-2024 Free Software Foundation, Inc.
5 #   This file is part of GNU Libtool.
7 # GNU Libtool is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License as
9 # published by the Free Software Foundation; either version 2 of
10 # the License, or (at your option) any later version.
12 # GNU Libtool is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Libtool; see the file COPYING.  If not, a copy
19 # can be downloaded from  http://www.gnu.org/licenses/gpl.html,
20 # or obtained by writing to the Free Software Foundation, Inc.,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 ####
24 # Check that deplibs are detected correctly even if there is no 'file'
25 # command installed.
27 AT_SETUP([deplibs without file command])
28 AT_KEYWORDS([libtool])
30 cwd=`pwd`
31 instdir=$cwd/inst
32 libdir=$instdir/lib
33 bindir=$instdir/bin
34 save_LDFLAGS=$LDFLAGS
35 LDFLAGS="$LDFLAGS -no-undefined"
37 mkdir inst inst/bin inst/lib
39 AT_DATA([a.c],
40 [[int a () { return 0; }
41 ]])
42 AT_DATA([b.c],
43 [[extern int a ();
44 int b () { return a (); }
45 ]])
47 for file in a.c b.c; do
48   $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file
49 done
50 AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo -rpath $libdir],
51          [], [ignore], [ignore])
52 AT_CHECK([library_names= && . ./liba.la && if test -z "$library_names"; then exit 77; fi ],
53          [], [ignore], [ignore])
54 AT_CHECK([$LIBTOOL --mode=install cp liba.la $libdir], [], [ignore], [ignore])
55 AT_CHECK([$LIBTOOL --mode=clean rm -f liba.la], [], [ignore], [ignore])
56 rm -f $libdir/liba.la
58 # check once with 'file' (if present) and once without, if on MinGW.
59 for try in with-file without-file; do
60   AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb.la b.lo -rpath $libdir ]dnl
61            [-L$libdir -la],
62            [], [ignore], [ignore])
63   AT_CHECK([library_names= && . ./libb.la && if test -z "$library_names"; then exit 99; fi ],
64            [], [ignore], [ignore])
66   case $host_os in
67   mingw* | windows*)
68     if file /; then
69       mkdir bin new-libtool
71       cat >bin/file <<\EOF
72 #! /bin/sh
73 exit 1
74 EOF
75       chmod +x bin/file
76       PATH=`pwd`/bin${PATH_SEPARATOR-:}$PATH
77       cd new-libtool
78       # configure might fail due to in-tree build of toplevel, or
79       # missing configure flags and other reasons.
80       LDFLAGS=$save_LDFLAGS
81       LT_AT_CONFIGURE([|| exit 77], ["$abs_top_srcdir"/configure])
82       LDFLAGS="$LDFLAGS -no-undefined"
83       cd ..
84       LIBTOOL=new-libtool/libtool
85       export LIBTOOL
86       # Check whether the generated script is usable; otherwise, skip.
87       AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libunrelated.la a.lo -rpath $libdir] dnl
88                [|| exit 77], [], [ignore], [ignore])
89     else
90       break;
91     fi;;
92   *)
93     break;;
94   esac
95 done
97 AT_CLEANUP