Imported Upstream version 2.4.2
[platform/upstream/libtool.git] / tests / subproject.at
1 # subproject.at -- test subproject Libltdl builds             -*- Autotest -*-
2 #
3 #   Copyright (C) 2005, 2008 Free Software Foundation, Inc.
4 #   Written by Gary V. Vaughan, 2005
5 #
6 #   This file is part of GNU Libtool.
7 #
8 # GNU Libtool is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License as
10 # published by the Free Software Foundation; either version 2 of
11 # the License, or (at your option) any later version.
12 #
13 # GNU Libtool is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with GNU Libtool; see the file COPYING.  If not, a copy
20 # can be downloaded from  http://www.gnu.org/licenses/gpl.html,
21 # or obtained by writing to the Free Software Foundation, Inc.,
22 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 ####
24
25 AT_BANNER([Subproject Libltdl.])
26
27 # _LT_AT_LTDL_SETUP
28 # -----------------
29 m4_pushdef([_LT_AT_LTDL_SETUP],
30 [AT_DATA([configure.ac],
31 [[AC_INIT([subproject-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
32 LT_CONFIG_LTDL_DIR([sub/ltdl])
33 AC_CONFIG_AUX_DIR([sub/ltdl/config])
34 AC_CONFIG_MACRO_DIR([sub/ltdl/m4])
35 AM_INIT_AUTOMAKE([foreign])
36 LT_INIT
37 LT_WITH_LTDL
38 AC_CONFIG_FILES([Makefile])
39 AC_OUTPUT
40 ]])
41
42 AT_DATA([Makefile.am],
43 [[ACLOCAL_AMFLAGS = -I sub/ltdl/m4
44 AUTOMAKE_OPTIONS = 1.9
45 SUBDIRS = sub/ltdl
46 lib_LTLIBRARIES = foo.la
47 foo_la_LDFLAGS = -module -avoid-version -no-undefined
48 ]])
49
50 echo 'int dummy = 0;' > foo.c
51 ])# _LT_AT_LTDL_SETUP
52
53 ## ------------------------ ##
54 ## Softlinked libltdl tree. ##
55 ## ------------------------ ##
56
57 AT_SETUP([compiling softlinked libltdl])
58
59 _LT_AT_LTDL_SETUP
60
61 LT_AT_BOOTSTRAP([--ltdl], [-I sub/ltdl/m4], [ignore], [--add-missing --copy],
62         [], [], [all $tst_dist])
63
64 AT_CHECK([test -f sub/ltdl/libltdlc.la])
65
66 AT_CLEANUP
67
68
69 ## -------------------- ##
70 ## Copied libltdl tree. ##
71 ## -------------------- ##
72
73 AT_SETUP([compiling copied libltdl])
74
75 _LT_AT_LTDL_SETUP
76
77 LT_AT_BOOTSTRAP([--copy --ltdl], [-I sub/ltdl/m4], [ignore],
78         [--add-missing --copy], [], [], [all $tst_dist])
79
80 AT_CHECK([test -f sub/ltdl/libltdlc.la])
81
82 AT_CLEANUP
83
84
85 ## ------------------------- ##
86 ## Installable libltdl tree. ##
87 ## ------------------------- ##
88
89 AT_SETUP([installable libltdl])
90
91 prefix=`pwd`/_inst
92
93 _LT_AT_LTDL_SETUP
94
95 LT_AT_BOOTSTRAP([--copy --ltdl], [-I sub/ltdl/m4], [ignore],
96         [--add-missing --copy], [], [--enable-ltdl-install --prefix=$prefix],
97         [all install $tst_dist])
98
99 AT_CHECK([test -f $prefix/lib/libltdl.la])
100 AT_CHECK([test -f $prefix/include/ltdl.h])
101
102 AT_CLEANUP
103
104
105 ## ----------------------------------------------- ##
106 ## libltdl is usable without Autoconf or Automake. ##
107 ## ----------------------------------------------- ##
108
109 AT_SETUP([linking libltdl without autotools])
110
111 _LTDL_PROJECT_FILES([sub/ltdl])
112 LT_AT_LIBTOOLIZE([--copy --ltdl=sub/ltdl])
113 LT_AT_MAKE([], [CC="$CC" LIBTOOLFLAGS="$LIBTOOLFLAGS" CPPFLAGS="$CPPFLAGS" ]dnl
114      [CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" SHELL="$SHELL" MAKE="${MAKE-make}" ]dnl
115      [CONFIGURE_OPTIONS="$configure_options"])
116
117 LT_AT_EXEC_CHECK([./ltdldemo], 0, [ignore])
118
119 AT_CLEANUP
120
121 dnl Be careful not to let the definition leak into other tests
122 m4_popdef([_LT_AT_LTDL_SETUP])