* m4/libtool.m4 [darwin]: Don't use a libname triplet, a couplet
[libtool.git] / tests / suffix.test
blob1712847f158ee34282218ebc742cc926d5e99cc1
1 #! /bin/sh
2 # suffix.test - check that libtool knows how to transform source suffices.
4 # Copyright (C) 2003 Free Software Foundation, Inc.
5 # This is free software; see the source for copying conditions. There is NO
6 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, a copy can be downloaded from
20 # http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
21 # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 # MA 02111-1307, USA.
24 # Extensions taken from the ones that Automake recognizes, plus Objective C,
25 # and GNU Ada.
26 extensions="C F S ada adb ads asm c c++ cc cpp cxx f f90 for m s"
27 bad_names="foo."
29 if test -z "$srcdir"; then
30 srcdir=`echo "$0" | sed 's%/[^/]*$%%'`
31 test "$srcdir" = "$0" && srcdir=.
33 . $srcdir/defs || exit 1
35 status=$EXIT_SUCCESS
36 for ext in $extensions; do
37 # Try a sample compile command.
38 if ($libtool -n --mode=compile compiler -c foo.$ext 2>&1; exit 0) | grep 'cannot'; then
39 status=$EXIT_FAILURE
40 else
41 echo "recognized foo.$ext as a valid source file"
43 done
45 # Make sure that invalid suffixes are not recognized.
46 for name in $bad_names; do
47 if ($libtool -n --mode=compile compiler -c $name 2>&1; exit 0) | grep 'cannot'; then :
48 else
49 echo "incorrectly recognized $name as a valid source file"
50 status=$EXIT_FAILURE
52 done
54 exit $status