diff --git a/configure.ac b/configure.ac index 47f5eccf5e4740972fe2caf7b4ed17e04040c033..c7429a68e691cab2c87979c0d486a4e3735d6a9d 100644 --- a/configure.ac +++ b/configure.ac @@ -51,6 +51,19 @@ LT_INIT([pic-only]) dnl _KPSE_USE_LIBTOOL ensures libtool is also used for configure-time tests, dnl which deduces dependent libraries automatically _KPSE_USE_LIBTOOL +_KPSE_CHECK_LIBTOOL +AS_IF([test -n "$FC" && test "X$FC" != Xno], + [AC_LANG_PUSH([Fortran]) + _KPSE_CHECK_LIBTOOL + AC_LANG_POP([Fortran])]) +AS_IF([test -n "$F77" && test "X$F77" != Xno], + [AC_LANG_PUSH([Fortran 77]) + _KPSE_CHECK_LIBTOOL + AC_LANG_POP([Fortran 77])]) +AS_IF([test -n "$CXX" && test "X$CXX" != Xno], + [AC_LANG_PUSH([C++]) + _KPSE_CHECK_LIBTOOL + AC_LANG_POP([C++])]) # ----------------------------------------------------------------------- # Check endianess of system diff --git a/m4/kpse_libtool.m4 b/m4/kpse_libtool.m4 index a0286fb7591542e5b23c3bed2610539592a6d75f..c382294c586c62cf5181b005e2429a7cf6b6e116 100644 --- a/m4/kpse_libtool.m4 +++ b/m4/kpse_libtool.m4 @@ -35,3 +35,17 @@ AC_PROVIDE_IFELSE([AC_PROG_F77], ])])[]dnl AC_LANG(_AC_LANG)[]dnl ]) # _KPSE_USE_LIBTOOL + +# _KPSE_CHECK_LIBTOOL([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE]) +# Check that we can link programs written in the current language with libtool +# ------------------- +AC_DEFUN([_KPSE_CHECK_LIBTOOL], + [m4_pushdef([acx_cache_var], [acx_cv_libtool_[]_AC_LANG_ABBREV[]_works])dnl + AC_CACHE_CHECK([whether libtool can link _AC_LANG programs], + [acx_cache_var], + [acx_cache_var=no + AC_LINK_IFELSE([AC_LANG_PROGRAM], [acx_cache_var=yes])]) + AS_VAR_IF([acx_cache_var], [no], [m4_default([$2], + [AC_MSG_FAILURE([unable to link a _AC_LANG program using libtool])])], + [$1]) + m4_popdef([acx_cache_var])])