hplip/hplip-configure-python.patch

53 lines
1.7 KiB
Diff
Raw Normal View History

diff -up hplip-3.20.9/configure.in.configure-python hplip-3.20.9/configure.in
--- hplip-3.20.9/configure.in.configure-python 2020-09-23 07:24:27.000000000 +0200
+++ hplip-3.20.9/configure.in 2020-10-02 07:27:09.082331431 +0200
@@ -604,17 +604,29 @@ if test "$class_driver" = "no" && test "
fi
fi
-SAVE_CPPFLAGS="$CPPFLAGS"
-CFLAGS=`python-config --includes`
-if [ $? -eq 0 ]
-then
- echo $FLAGS
-else
-CFLAGS=`python3-config --includes`
- if [ $? -eq 0 ]
- then
- echo $FLAGS
- fi
+AC_PATH_PROG(python3_config_path, python3-config, [AC_MSG_ERROR([python3-config not installed], 6)])
+
+PYTHON_INCLUDES=`$python3_config_path --includes`
+if test "X$PYTHON_INCLUDES" = "X" ; then
+ AC_MSG_ERROR([Cannot get Python includes via python3-config], 6)
+fi
+
+PYTHON_LIBS=`$python3_config_path --libs`
+if test "X$PYTHON_LIBS" = "X" ; then
+ AC_MSG_ERROR([Cannot get Python libs via python3-config], 6)
+fi
+
+SAVE_CFLAGS=$CFLAGS
+SAVE_LIBS=$LIBS
+
+CFLAGS="$CFLAGS $PYTHON_INCLUDES"
+LIBS="$LIBS $PYTHON_LIBS"
+
+AC_TRY_LINK(,[ ], AC_MSG_RESULT(yes); python_includes="ok", AC_MSG_ERROR([no: PYTHON DISABLED], 6))
+
+if test "X$python_includes" != "Xok" ; then
+ CFLAGS="$SAVE_CFLAGS"
+ LIBS="$SAVE_LIBS"
fi
#CFLAGS=`(python-config --includes)`
@@ -631,7 +643,6 @@ if test "$class_driver" = "no" && test "
AS_IF([test "x$FOUND_HEADER" != "xyes"],
[AC_MSG_ERROR([cannot find python-devel support], 6)])
fi
-CFLAGS="$save_CFLAGS"
if test "$hpijs_only_build" = "no" && test "$scan_build" = "yes" && test "$hpcups_only_build" = "no"; then
AC_CHECK_LIB([sane], [sane_open], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find sane-backends-devel support (or --disable-scan-build)], 12)])