1#! /bin/sh
2# suffix.test - check that libtool knows how to transform source suffices.
3
4# Extensions taken from the ones that Automake recognizes, plus Objective C,
5# and GNU Ada.
6extensions="C F S ada adb ads asm c c++ cc cpp cxx f f90 for m s"
7bad_names="foo."
8
9# Test script header.
10need_prefix=no
11if test -z "$srcdir"; then
12  srcdir=`echo "$0" | sed 's%/[^/]*$%%'`
13  test "$srcdir" = "$0" && srcdir=.
14  test "${VERBOSE+set}" != "set" && VERBOSE=yes
15fi
16. $srcdir/defs || exit 1
17
18status=0
19for ext in $extensions; do
20  # Try a sample compile command.
21  if ($libtool -n --mode=compile compiler -c foo.$ext 2>&1; exit 0) | grep 'cannot'; then
22    status=1
23  else
24    echo "recognized foo.$ext as a valid source file"
25  fi
26done
27
28# Make sure that invalid suffixes are not recognized.
29for name in $bad_names; do
30  if ($libtool -n --mode=compile compiler -c $name 2>&1; exit 0) | grep 'cannot'; then :
31  else
32    echo "incorrectly recognized $name as a valid source file"
33    status=1
34  fi
35done
36
37exit $status
38