~ubuntu-branches/ubuntu/precise/automake1.11/precise-proposed

« back to all changes in this revision

Viewing changes to tests/ltcond2.test

  • Committer: Bazaar Package Importer
  • Author(s): Eric Dorland
  • Date: 2009-08-12 02:36:44 UTC
  • Revision ID: james.westby@ubuntu.com-20090812023644-f40we9eqbmx1dpbj
Tags: upstream-1.11
ImportĀ upstreamĀ versionĀ 1.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
# Copyright (C) 2003, 2004  Free Software Foundation, Inc.
 
3
#
 
4
# This program is free software; you can redistribute it and/or modify
 
5
# it under the terms of the GNU General Public License as published by
 
6
# the Free Software Foundation; either version 2, or (at your option)
 
7
# any later version.
 
8
#
 
9
# This program is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
# GNU General Public License for more details.
 
13
#
 
14
# You should have received a copy of the GNU General Public License
 
15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
16
 
 
17
# Test for bug in conditionals.
 
18
 
 
19
required='libtoolize gcc'
 
20
. ./defs || Exit 1
 
21
 
 
22
set -e
 
23
 
 
24
cat >> configure.in << 'END'
 
25
AC_PROG_CC
 
26
AC_PROG_LIBTOOL
 
27
AC_SUBST([HELLO_SYSTEM], [hello-generic.lo])
 
28
AM_CONDITIONAL([LINUX], true)
 
29
AC_OUTPUT
 
30
END
 
31
 
 
32
cat > Makefile.am << 'END'
 
33
lib_LTLIBRARIES = libhello.la
 
34
libhello_la_SOURCES = hello-common.c
 
35
EXTRA_libhello_la_SOURCES = hello-linux.c hello-generic.c
 
36
libhello_la_LIBADD = $(HELLO_SYSTEM)
 
37
libhello_la_DEPENDENCIES = $(HELLO_SYSTEM)
 
38
 
 
39
lib_LTLIBRARIES += libhello2.la
 
40
libhello2_la_SOURCES = hello-common.c
 
41
if LINUX
 
42
libhello2_la_SOURCES += hello-linux.c
 
43
else
 
44
libhello2_la_SOURCES += hello-generic.c
 
45
endif
 
46
 
 
47
bin_PROGRAMS = hello hello2
 
48
hello_SOURCES = main.c
 
49
hello_LDADD = libhello.la
 
50
hello2_SOURCES = main.c
 
51
hello2_LDADD = libhello2.la
 
52
 
 
53
check-local:
 
54
        ./hello$(EXEEXT) | grep hello-generic
 
55
        ./hello2$(EXEEXT) | grep hello-linux
 
56
        : > check-ok
 
57
END
 
58
 
 
59
echo 'char* str() { return "hello-linux"; }' >hello-linux.c
 
60
echo 'char* str() { return "hello-generic"; }' >hello-generic.c
 
61
cat >hello-common.c <<'END'
 
62
#include <stdio.h>
 
63
char* str();
 
64
void print()
 
65
{
 
66
  puts (str ());
 
67
}
 
68
END
 
69
echo 'int main() { print(); return 0; }' >main.c
 
70
 
 
71
libtoolize
 
72
$ACLOCAL
 
73
$AUTOCONF
 
74
$AUTOMAKE --add-missing
 
75
./configure
 
76
$MAKE check
 
77
test -f check-ok