Changeset 2346


Ignore:
Timestamp:
Oct 22, 2010, 12:23:33 AM (12 years ago)
Author:
Peter
Message:

refs #496. re-writing YAT_LT_LINK_IFELSE based on suggestion from Peter Breitenlohner

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/m4/yat_lt_link_ifelse.m4

    r2245 r2346  
    2727#
    2828
     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
    2933#
    30 # serial 0
     34# serial 1
    3135#
    3236
    3337AC_DEFUN([YAT_LT_LINK_IFELSE],
    3438[
    35   # currently we assume that language is C++
    36   AC_LANG_ASSERT([C++])
    37   AC_REQUIRE([AC_PROG_LIBTOOL])
    38   ac_yat_lt_link_ifelse=yes
    39   LT_OUTPUT
    40   AC_LANG_CONFTEST([$1])
    41 
    42   rm -f conftest.lo
    43   YAT_RUN_LOG([$SHELL libtool --tag=CXX --mode=compile $CXX $CXXFLAGS $CPPFLAGS -c -o conftest.lo conftest.$ac_ext], [], [ac_yat_lt_link_ifelse=no])
    44 
    45   rm -f conftest
    46   YAT_RUN_LOG([$SHELL libtool --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o conftest conftest.lo $LIBS], [], [ac_yat_lt_link_ifelse=no])
    47 
    48   AS_IF([test x$ac_yat_lt_link_ifelse = xyes], [$2], [$3])
     39  YAT_USE_LIBTOOL_PUSH
     40  AC_LINK_IFELSE($@)
     41  YAT_USE_LIBTOOL_POP
    4942]) # YAT_LT_LINK_IFELSE
    5043
     44AC_DEFUN([YAT_USE_LIBTOOL_PUSH],
     45[
     46m4_defn([LT_INIT])
     47m4_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
    5156
     57AC_DEFUN([YAT_USE_LIBTOOL_POP],
     58[
     59m4_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
    5265
     66m4_define([_YAT_USE_LIBTOOL_TAG],
     67[AC_LANG_CASE([C], [CC],
     68              [C++], [CXX],
     69              [Fortran 77], [F77],
     70              [Fortran], [FC])
     71])
Note: See TracChangeset for help on using the changeset viewer.