From 78c7aac42af455cafbb8606bbb99b1345e93f3a4 Mon Sep 17 00:00:00 2001
From: Klaus Rabbertz <klaus.rabbertz@cern.ch>
Date: Thu, 13 Jun 2024 11:22:42 +0200
Subject: [PATCH] Fix missing LDFLAGS for HOPPET; fix warnings for unused
 variables in conditional compiling; update CL, NEWS

---
 v2.5/toolkit/ChangeLog              |  7 +++++-
 v2.5/toolkit/NEWS                   |  4 +++-
 v2.5/toolkit/src/Makefile.am        | 36 ++++++++++++-----------------
 v2.5/toolkit/src/fnlo-tk-rootout.cc | 14 +++++++----
 4 files changed, 33 insertions(+), 28 deletions(-)

diff --git a/v2.5/toolkit/ChangeLog b/v2.5/toolkit/ChangeLog
index 8179dd6b..3f5c18c7 100644
--- a/v2.5/toolkit/ChangeLog
+++ b/v2.5/toolkit/ChangeLog
@@ -1,6 +1,11 @@
-2024-06-13  Public release of the fastNLO_toolkit package version 2.5.1, tag 3032
+2024-06-13  Public release of the fastNLO_toolkit package version 2.5.1, tag 3034
             =====================================================================
 
+2024-06-13  Klaus Rabbertz <klaus.rabbertz@cern.ch>
+
+        Fix a missing LDFLAGS setting in case of HOPPET use
+        Fix a few warnings for unused variables in conditional compiling of fnlo-tk-rootout
+
 2024-06-12  Klaus Rabbertz <klaus.rabbertz@cern.ch>
 
         Adapt hoppet test to new default a_s = 0.1180 instead of 0.1181
diff --git a/v2.5/toolkit/NEWS b/v2.5/toolkit/NEWS
index da81940f..d5e4cf5e 100644
--- a/v2.5/toolkit/NEWS
+++ b/v2.5/toolkit/NEWS
@@ -1,5 +1,7 @@
-Notes for public release of the fastNLO_toolkit package version 2.5.1, tag 3032
+Notes for public release of the fastNLO_toolkit package version 2.5.1, tag 3034
 ===============================================================================
+- Fix a missing LDFLAGS setting in case of HOPPET use
+- Fix a few warnings for unused variables in conditional compiling of fnlo-tk-rootout
 - Adapt hoppet test to new default a_s = 0.1180 instead of 0.1181
 - Require full C++17 functionality
 
diff --git a/v2.5/toolkit/src/Makefile.am b/v2.5/toolkit/src/Makefile.am
index d456f2eb..75bc6a41 100644
--- a/v2.5/toolkit/src/Makefile.am
+++ b/v2.5/toolkit/src/Makefile.am
@@ -43,7 +43,7 @@ fnlo_tk_merge_SOURCES   = fnlo-tk-merge.cc
 fnlo_tk_merge2_SOURCES  = fnlo-tk-merge2.cc
 fnlo_tk_append_SOURCES  = fnlo-tk-append.cc
 fnlo_tk_modify_SOURCES  = fnlo-tk-modify.cc
-fnlo_tk_cat_SOURCES   = fnlo-tk-cat.cc
+fnlo_tk_cat_SOURCES     = fnlo-tk-cat.cc
 
 #
 # Preprocessor flags
@@ -57,14 +57,11 @@ if HAVE_LHAPDF
 endif
 
 # Individual targets
-fnlo_tk_cppread_CPPFLAGS = $(my_include_dirs) -I${includedir} $(LHAPDFCPPFLAGS) $(AM_CPPFLAGS)
-fnlo_tk_example_CPPFLAGS = $(my_include_dirs) -I${includedir} $(ROOTCPPFLAGS) $(AM_CPPFLAGS)
-if HAVE_ROOT
-   fnlo_tk_example_CPPFLAGS += $(ROOTCPPFLAGS)
-endif
-fnlo_tk_yodaout_CPPFLAGS = $(my_include_dirs) -I${includedir} $(YODACPPFLAGS) $(AM_CPPFLAGS)
-fnlo_tk_statunc_CPPFLAGS = $(my_include_dirs) -I${includedir} $(YODACPPFLAGS) $(AM_CPPFLAGS)
-fnlo_tk_rootout_CPPFLAGS = $(my_include_dirs) -I${includedir} $(ROOTCPPFLAGS) $(AM_CPPFLAGS)
+fnlo_tk_cppread_CPPFLAGS = $(my_include_dirs) -I${includedir} $(AM_CPPFLAGS) $(LHAPDFCPPFLAGS)
+fnlo_tk_example_CPPFLAGS = $(my_include_dirs) -I${includedir} $(AM_CPPFLAGS) $(ROOTCPPFLAGS)
+fnlo_tk_yodaout_CPPFLAGS = $(my_include_dirs) -I${includedir} $(AM_CPPFLAGS) $(YODACPPFLAGS)
+fnlo_tk_statunc_CPPFLAGS = $(my_include_dirs) -I${includedir} $(AM_CPPFLAGS) $(YODACPPFLAGS)
+fnlo_tk_rootout_CPPFLAGS = $(my_include_dirs) -I${includedir} $(AM_CPPFLAGS) $(ROOTCPPFLAGS)
 fnlo_tk_merge_CPPFLAGS   = $(my_include_dirs) -I${includedir} $(AM_CPPFLAGS)
 fnlo_tk_merge2_CPPFLAGS  = $(my_include_dirs) -I${includedir} $(AM_CPPFLAGS)
 fnlo_tk_append_CPPFLAGS  = $(my_include_dirs) -I${includedir} $(AM_CPPFLAGS)
@@ -74,18 +71,15 @@ fnlo_tk_cat_CPPFLAGS     = $(my_include_dirs) -I${includedir} $(AM_CPPFLAGS)
 #
 # C++ compiler flags
 #
-# Recall: -std=c++11 is requested by default through configure.ac macro AX_CXX_COMPILE_STDCXX_11
+# Recall: -std=c++17 is requested by default through configure.ac macro AX_CXX_COMPILE_STDCXX_17
 #         and works with g++, clang etc.!
-#         -std=gnu++11 is restricted to g++ only and not the best option
+#         -std=gnu++17 is restricted to g++ only and not the best option
 # All targets
 AM_CXXFLAGS = -g -O2 -Wall -Wdeprecated-declarations
 # Debug flags
 # AM_CXXFLAGS = -g -ftrapping-math -fsignaling-nans -O0 -Wall
-fnlo_tk_cppread_CXXFLAGS = $(AM_CXXFLAGS)
-fnlo_tk_example_CXXFLAGS = $(AM_CXXFLAGS)
-if HAVE_ROOT
-   fnlo_tk_example_CXXFLAGS += $(ROOTCXXFLAGS)
-endif
+fnlo_tk_cppread_CXXFLAGS = $(AM_CXXFLAGS) $(HOPPETCXXFLAGS)
+fnlo_tk_example_CXXFLAGS = $(AM_CXXFLAGS) $(ROOTCXXFLAGS)
 fnlo_tk_yodaout_CXXFLAGS = $(AM_CXXFLAGS)
 fnlo_tk_statunc_CXXFLAGS = $(AM_CXXFLAGS)
 fnlo_tk_rootout_CXXFLAGS = $(AM_CXXFLAGS) $(ROOTCXXFLAGS)
@@ -101,13 +95,13 @@ fnlo_tk_cat_CXXFLAGS     = $(AM_CXXFLAGS)
 # Require lhapdf, use lhapdf-config if possible
 # All targets
 AM_LDFLAGS = -L${pkglibdir} -lfastnlotoolkit
+if HAVE_HOPPET
+   AM_LDFLAGS += -lgfortran
+endif
 my_lib_dirs = -L${srcdir}/../fastnlotoolkit -lfastnlotoolkit -L${top_builddir}/fastnlotoolkit -lfastnlotoolkit -L${top_srcdir}/fastnlotoolkit -lfastnlotoolkit
 # Individual targets
-fnlo_tk_cppread_LDFLAGS = $(my_lib_dirs) $(AM_LDFLAGS) $(LHAPDFLDFLAGS)
-fnlo_tk_example_LDFLAGS = $(my_lib_dirs) $(AM_LDFLAGS) $(LHAPDFLDFLAGS)
-if HAVE_ROOT
-   fnlo_tk_example_LDFLAGS += $(ROOTLDFLAGS)
-endif
+fnlo_tk_cppread_LDFLAGS = $(my_lib_dirs) $(AM_LDFLAGS) $(LHAPDFLDFLAGS) $(HOPPETLDFLAGS)
+fnlo_tk_example_LDFLAGS = $(my_lib_dirs) $(AM_LDFLAGS) $(LHAPDFLDFLAGS) $(ROOTLDFLAGS)
 fnlo_tk_yodaout_LDFLAGS = $(my_lib_dirs) $(AM_LDFLAGS) $(LHAPDFLDFLAGS) $(YODALDFLAGS)
 fnlo_tk_statunc_LDFLAGS = $(my_lib_dirs) $(AM_LDFLAGS) $(LHAPDFLDFLAGS) $(YODALDFLAGS)
 fnlo_tk_rootout_LDFLAGS = $(my_lib_dirs) $(AM_LDFLAGS) $(LHAPDFLDFLAGS) $(ROOTLDFLAGS)
diff --git a/v2.5/toolkit/src/fnlo-tk-rootout.cc b/v2.5/toolkit/src/fnlo-tk-rootout.cc
index fe1c7898..a6a29cc7 100644
--- a/v2.5/toolkit/src/fnlo-tk-rootout.cc
+++ b/v2.5/toolkit/src/fnlo-tk-rootout.cc
@@ -61,9 +61,11 @@ int main(int argc, char** argv) {
    }
 
    //! --- Parse commmand line
+#ifdef WITH_ROOT
    char buffer[1024];
    char titlel[1024];
    char titleu[1024];
+#endif
    string tablename;
    if (argc <= 1) {
       yell << "" << endl;
@@ -165,7 +167,7 @@ int main(int argc, char** argv) {
    //! --- Uncertainty choice
    EScaleUncertaintyStyle eScaleUnc = kScaleNone;
    EPDFUncertaintyStyle   ePDFUnc   = kPDFNone;
-   EAsUncertaintyStyle    eAsUnc    = kAsNone;
+   // EAsUncertaintyStyle    eAsUnc    = kAsNone;
    EStatUncertaintyStyle  eStatUnc  = kStatNone;
    string chunc;
    if (argc > 3) {
@@ -423,9 +425,11 @@ int main(int argc, char** argv) {
 #endif
 
    //  Define histogram multiplicity and initialise histogram counter
+#ifdef WITH_ROOT
    const unsigned int nMult = 3;
-   unsigned int nHist       = 0;
    unsigned int nHistAll    = 0;
+#endif
+   unsigned int nHist       = 0;
 
    //! --- Now loop over PDF sets
    for (unsigned int iPDF=0; iPDF<PDFFiles.size(); iPDF++) {
@@ -470,7 +474,9 @@ int main(int argc, char** argv) {
          fnlo->CalcCrossSection();
 
          //! Do PDF, statistical/numerical, and scale uncertainties
+#ifdef WITH_ROOT
          unsigned int iOffs[4] = {1,3,6,8};
+#endif
          for (unsigned int iUnc = 0; iUnc<4; iUnc++) {
 
             //! Get cross section & uncertainties (only for additive perturbative contributions)
@@ -561,7 +567,6 @@ int main(int argc, char** argv) {
 #ifdef WITH_ROOT
             //! --- Book ROOT histos
             TH1D *histo[nMult*nHist];
-#endif
 
             //! Loop over no. of histograms
             unsigned int iobs = 0;
@@ -593,7 +598,6 @@ int main(int argc, char** argv) {
                   exit(1);
                }
 
-#ifdef WITH_ROOT
                // Arrays to fill ROOT histos
                // N+1 bin borders
                double xbins[nHistBins+1];
@@ -656,7 +660,6 @@ int main(int argc, char** argv) {
                histo[ih+iUnc]->GetXaxis()->SetTitle(fnlo->GetDimLabels()[NDim-1].c_str());
                histo[ih+iUnc]->GetYaxis()->SetTitle(titleu);
                nHistAll++;
-#endif
 
                if (NDim == 1 ) {
                   iobs = 0;
@@ -677,6 +680,7 @@ int main(int argc, char** argv) {
                   }
                }
             }
+#endif
          }
       }
    }
-- 
GitLab