ltmain.in: Use func_warning for all warnings
[libtool.git] / tests / pic_flag.at
blob6d27a1675516ebe22c499a39e9414211d4469d60
1 # pic_flag.at -- override the pic_flag at configure time   -*- 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 AT_SETUP([override pic_flag at configure time])
26 # Just try to configure the Libtool package with -fpic if we can compile
27 # with it, for C and C++.
29 AT_DATA([foo.c],
30 [[int data = 42;
31 int func(void) { return data; }
32 ]])
34 cp foo.c foo.cpp
35 C_pic_flag='-fpic -DPIC'
36 AT_CHECK([$CC $CPPFLAGS $CFLAGS $C_pic_flag -c foo.c || exit 77],
37          [], [stdout], [stderr])
38 # The configure test for the PIC flag also checks for warnings.
39 AT_CHECK([$GREP fpic stdout stderr && exit 77], [1])
40 AT_CHECK([[$GREP '[uU]nknown.*option' stdout stderr && exit 77]], [1])
42 CXX_pic_flag='-fpic -DPIC'
43 if $CXX $CPPFLAGS $CXXFLAGS $CXX_pic_flag -c foo.cpp; then :; else
44   CXX_pic_flag=
47 # Set up a tests/demo.at style project.
48 _LT_DEMO_SETUP
50 # Bootstrap, and configure it so that we can extract libtool --config
51 # settings.
52 LT_AT_BOOTSTRAP([], [-I m4], [], [--add-missing], [],
53     [ignore], [ignore])
55 LT_AT_CONFIGURE([lt_cv_prog_compiler_pic="$C_pic_flag" ]dnl
56                 [lt_cv_prog_compiler_pic_CXX="$CXX_pic_flag"],
57                 [./configure])
58 : ${MAKE=make}
59 AT_CHECK([$MAKE], [], [stdout], [ignore])
60 AT_CHECK([if ./libtool --features | $GREP 'enable shared libraries'; then ]dnl
61          [  $GREP ' -fpic' stdout; else exit 77; fi], [], [ignore], [ignore])
63 AT_CLEANUP