1 | ## $Id: yat_lt_link_ifelse.m4 2346 2010-10-21 22:23:33Z peter $ |
---|
2 | # |
---|
3 | # SYNOPSIS |
---|
4 | # |
---|
5 | # YAT_LT_LINK_IFELSE(program, [action-if-true], [action-if-not-true]) |
---|
6 | # |
---|
7 | # DESCRIPTION |
---|
8 | # |
---|
9 | # COPYLEFT |
---|
10 | # |
---|
11 | # Copyright (C) 2010 Peter Johansson |
---|
12 | # |
---|
13 | # This file is part of the yat library, http://dev.thep.lu.se/yat |
---|
14 | # |
---|
15 | # The yat library is free software; you can redistribute it and/or |
---|
16 | # modify it under the terms of the GNU General Public License as |
---|
17 | # published by the Free Software Foundation; either version 3 of the |
---|
18 | # License, or (at your option) any later version. |
---|
19 | # |
---|
20 | # The yat library is distributed in the hope that it will be useful, |
---|
21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
23 | # General Public License for more details. |
---|
24 | # |
---|
25 | # You should have received a copy of the GNU General Public License |
---|
26 | # along with yat. If not, see <http://www.gnu.org/licenses/>. |
---|
27 | # |
---|
28 | |
---|
29 | # Based on _KPSE_USE_LIBTOOL by |
---|
30 | # Peter Breitenlohner <peb@mppmu.mpg.de> shared here |
---|
31 | # http://www.mail-archive.com/autoconf@gnu.org/msg19948.html |
---|
32 | |
---|
33 | # |
---|
34 | # serial 1 |
---|
35 | # |
---|
36 | |
---|
37 | AC_DEFUN([YAT_LT_LINK_IFELSE], |
---|
38 | [ |
---|
39 | YAT_USE_LIBTOOL_PUSH |
---|
40 | AC_LINK_IFELSE($@) |
---|
41 | YAT_USE_LIBTOOL_POP |
---|
42 | ]) # YAT_LT_LINK_IFELSE |
---|
43 | |
---|
44 | AC_DEFUN([YAT_USE_LIBTOOL_PUSH], |
---|
45 | [ |
---|
46 | m4_defn([LT_INIT]) |
---|
47 | m4_ifdef([_YAT_USE_LIBTOOL],, |
---|
48 | [m4_define([_YAT_USE_LIBTOOL], [yes]) |
---|
49 | LT_OUTPUT |
---|
50 | yat_use_libtool_ac_compile=$ac_compile; |
---|
51 | ac_compile="./libtool --mode=compile --tag=_YAT_USE_LIBTOOL_TAG $ac_link"; |
---|
52 | yat_use_libtool_ac_link=$ac_link; |
---|
53 | ac_link="./libtool --mode=link --tag=CXX $ac_link"; dnl |
---|
54 | ]) dnl |
---|
55 | ]) # YAT_USE_LIBTOOL_PUSH |
---|
56 | |
---|
57 | AC_DEFUN([YAT_USE_LIBTOOL_POP], |
---|
58 | [ |
---|
59 | m4_ifdef([_YAT_USE_LIBTOOL], dnl |
---|
60 | [m4_undefine([_YAT_USE_LIBTOOL]) |
---|
61 | ac_compile=$yat_use_libtool_ac_compile; |
---|
62 | ac_link=$yat_use_libtool_ac_link; |
---|
63 | ]) |
---|
64 | ]) # YAT_USE_LIBTOOL_POP |
---|
65 | |
---|
66 | m4_define([_YAT_USE_LIBTOOL_TAG], |
---|
67 | [AC_LANG_CASE([C], [CC], |
---|
68 | [C++], [CXX], |
---|
69 | [Fortran 77], [F77], |
---|
70 | [Fortran], [FC]) |
---|
71 | ]) |
---|