Michael Orlitzky on Tue, 01 Aug 2023 21:40:23 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PATCH 1/1] config/{Makefile.SH,get_fltk}: include fltk's CXXFLAGS


To test for fltk, pari compiles a test program using the output from
"fltk-config --ldflags". That provides the necessary -l and -L flags,
but if fltk's headers are in a nonstandard location, then the
corresponding -I flags will be absent. This can cause a compilation
failure (and thus feature misdetection) on e.g. Gentoo, where fltk's
headers are stored in /usr/include/fltk rather than /usr/include.
To fix the problem, this commit includes the output from "fltk-config
--cxxflags" in the compilation command.

The same issue arises when compiling pari (plotfltk.c) itself, and the
same fix applied to PLOTCFLAGS in Makefile.SH solves it.

This issue was originally debugged and fixed by François Bissey.
---
 config/Makefile.SH | 2 +-
 config/get_fltk    | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/config/Makefile.SH b/config/Makefile.SH
index fe90d6f05..6ca368c19 100644
--- a/config/Makefile.SH
+++ b/config/Makefile.SH
@@ -79,7 +79,7 @@ Qt4)
   PLOTLIBS="\$(QTLIB) $QTLIBS"
   graph=plotQt4;;
 fltk)
-  PLOTCFLAGS=
+  PLOTCFLAGS="$FLTK_CXXFLAGS"
   PLOTLIBS="$FLTK_LIBS"
   postconfig='fltk-config --post '
   graph=plotfltk;;
diff --git a/config/get_fltk b/config/get_fltk
index 87d0c1dd8..185a760c5 100644
--- a/config/get_fltk
+++ b/config/get_fltk
@@ -5,10 +5,16 @@ fi
 cmd="FLTK_LIBS=\`fltk-config --ldflags\`"
 . log_cmd
 
+cmd="FLTK_CXXFLAGS=\`fltk-config --cxxflags\`"
+. log_cmd
+
 exe=$osname-$arch-fltk$$$exe_suff
 cxx=$CXX
 if test -z "$cxx"; then cxx=g++; fi;
-cmd="$cxx $CFLAGS $FLTK_LIBS -o $exe has_fltk.c"
+
+# Note: the build system uses $CFLAGS (and not $CXXFLAGS) when
+# compiling plotfltk.c, so we do the same.
+cmd="$cxx $FLTK_CXXFLAGS $CFLAGS $FLTK_LIBS -o $exe has_fltk.c"
 . log_cmd
 if test -r "$exe"; then
   echo "Using FLTK library"
-- 
2.39.3