From 82b2223fbe6c161ecc6be49fc7fe2b8ab69539b3 Mon Sep 17 00:00:00 2001 From: Sergey Kosukhin <sergey.kosukhin@mpimet.mpg.de> Date: Mon, 30 Sep 2019 10:29:44 +0200 Subject: [PATCH] Check whether libtool works right after switching to it at the configure-time. --- configure.ac | 13 +++++++++++++ m4/kpse_libtool.m4 | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/configure.ac b/configure.ac index 47f5eccf5..c7429a68e 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 a0286fb75..c382294c5 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])]) -- GitLab