ltmain.in: Use func_warning for all warnings
[libtool.git] / tests / ctor.at
bloba9c2d007f554de147783ae1e3f6808c7f2e324f6
1 # ctor.at -- Test constructors via C++                        -*- Autotest -*-
3 #   Copyright (C) 2007-2008, 2011-2019, 2021-2024 Free Software
4 #   Foundation, Inc.
5 #   Written by Noah Misch, 2007
7 #   This file is part of GNU Libtool.
9 # GNU Libtool is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation; either version 2 of
12 # the License, or (at your option) any later version.
14 # GNU Libtool is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with GNU Libtool; see the file COPYING.  If not, a copy
21 # can be downloaded from  http://www.gnu.org/licenses/gpl.html,
22 # or obtained by writing to the Free Software Foundation, Inc.,
23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 ####
26 AT_BANNER([Constructors.])
28 AT_SETUP([C++ static constructors])
29 LT_AT_TAG([CXX])
30 AT_KEYWORDS([libtool])
32 AT_DATA(class.h,
33 [[#define magic 0xaabbccdd
34 class Foo {
35 public:
36         Foo() { bar = magic; }
37         unsigned bar;
40 extern Foo instance;
41 ]])
43 AT_DATA(libctor.cpp,
44 [[#include "class.h"
45 Foo instance;
46 ]])
48 AT_DATA(main.cpp,
49 [[#include "class.h"
51 int main(void)
53   return instance.bar != magic;
55 ]])
57 AT_CHECK([$LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS \
58           -c libctor.cpp -o libctor.lo], [0], [ignore], [ignore])
59 AT_CHECK([$LIBTOOL --tag=CXX --mode=compile $CXX $CPPFLAGS $CXXFLAGS \
60           -c main.cpp -o main.lo], [0], [ignore], [ignore])
61 AT_CHECK([$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS \
62           libctor.lo -o libctor.la -rpath /none], [0], [ignore], [ignore])
63 AT_CHECK([$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS \
64           main.lo libctor.la -o main$EXEEXT], [0], [ignore], [ignore])
66 LT_AT_EXEC_CHECK([./main], [0])
68 AT_CLEANUP