Michael Orlitzky on Tue, 01 Aug 2023 17:26:40 +0200


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

[PATCH 1/1] config/get_fltk: include fltk's CXXFLAGS in the compile-test


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, the corresponding
-I flags will be absent. This can cause a compilation failure (and
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 also includes the output from
"fltk-config --cxxflags" in the compilation command.

This issue was originally debugged and fixed by François Bissey.
---
 config/get_fltk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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