From 2d580e291074df8234805510b001f4a1f8a7ddbd Mon Sep 17 00:00:00 2001 From: David Berry Date: Wed, 16 Sep 2020 12:28:28 +0100 Subject: [PATCH] Fix issue with libyaml being a requirement for F77 support It seems that any library checked using AC_CHECK_LIB (e.g libyaml) automatically gets added to the list of linker options required to work with Fortran if AC_CHECK_LIB is used before AC_FC_LIBRARY_LDFLAGS. So this commit moves the use of AC_FC_LIBRARY_LDFLAGS so that it comes beore all use of AC_CHECK_LIB. This changes the "flibs" value in ast_link and ast_link_adam so that they no longer include -lyaml and -pthread. --- configure.ac | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/configure.ac b/configure.ac index 52da25c3..8391920f 100644 --- a/configure.ac +++ b/configure.ac @@ -86,6 +86,29 @@ else fi AM_CONDITIONAL(EXTERNAL_PAL, test x$external_pal = x1) +# Conditional defining whether we want to support Fortran libraries +# (e.g. pgplot) and applications. It seems that this must come before +# any uses of AC_CHECK_LIB as otherwise the library checked using +# AC_CHECK_LIB is automatically added to the list of linker options +# created by AC_FC_LIBRARY_LDFLAGS +AC_ARG_WITH([fortran], + [ --without-fortran Build package without Fortran support], + if test "$withval" = "yes"; then + use_fortran="1" + else + use_fortran="0" + fi, + use_fortran="1") +AM_CONDITIONAL(NOFORTRAN, test x$use_fortran = x0) +AC_SUBST(FORTRAN, $use_fortran) + +# ast_link needs to be able to link against the Fortran runtime if +# necessary +if test "$use_fortran" = "1"; then +AC_PROG_FC +AC_FC_LIBRARY_LDFLAGS +fi + # Checks for programs AC_PROG_CC @@ -177,26 +200,6 @@ AC_DEFUN([CIT_FUNCTIONSTRING], [ CIT_FUNCTIONSTRING -# Conditional defining whether we want to support Fortran libraries -# (e.g. pgplot) and applications. -AC_ARG_WITH([fortran], - [ --without-fortran Build package without Fortran support], - if test "$withval" = "yes"; then - use_fortran="1" - else - use_fortran="0" - fi, - use_fortran="1") -AM_CONDITIONAL(NOFORTRAN, test x$use_fortran = x0) -AC_SUBST(FORTRAN, $use_fortran) - -# ast_link needs to be able to link against the Fortran runtime if -# necessary -if test "$use_fortran" = "1"; then -AC_PROG_FC -AC_FC_LIBRARY_LDFLAGS -fi - # Find an absolute path to the Perl binary, augmenting the path with the # location of the Starlink Perl build. If this fails, then set @PERL@ # to the backup `/usr/bin/env perl', which will find Perl if it exists