ola-0003-fix-check-for-python-module-for-cross-compilation.patch 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. commit ea985068c2d699ffb5b353de090f7ded713c08a7
  2. Author: Yann E. MORIN <yann.morin.1998@free.fr>
  3. Date: Tue Jan 14 21:38:27 2014 +0100
  4. configure: add option for user to override checks for Python modules
  5. The check for google.protobuf is inherently flawed for cross-compilation,
  6. as it uses the host Python to check for target modules.
  7. In this case, it is not possible to check for a Pyhon modules altogether,
  8. and we need to rely on the user to properly tell us whether we do or do
  9. not have google.protobuf.
  10. This is done by adding am autoconf cache variable:
  11. ac_cv_have_pymod_google_protobuf
  12. which can be set to:
  13. - yes : force the test to be true
  14. - no : force the test to be false
  15. - (empty) : let the test decide
  16. This is then used in AX_PYTHON_MODULE to override the test.
  17. Currently, only the google.protobuf Python module is checked for, but
  18. the same could be done later on of other Python modules that may be
  19. added in the future, of course.
  20. Fixes configure-errors like:
  21. http://autobuild.buildroot.net/results/e63/e634d5f0cee3967caffaa6e7ada8c0968e3eff63/build-end.log
  22. Also fixes some under-quotation in the python module check.
  23. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
  24. ---
  25. Sent upstream, awaiting for response...
  26. diff --git a/config/ax_python_module.m4 b/config/ax_python_module.m4
  27. index 96dd1ab..2910e88 100644
  28. --- a/config/ax_python_module.m4
  29. +++ b/config/ax_python_module.m4
  30. @@ -25,20 +25,17 @@
  31. AU_ALIAS([AC_PYTHON_MODULE], [AX_PYTHON_MODULE])
  32. AC_DEFUN([AX_PYTHON_MODULE],[
  33. - AC_MSG_CHECKING($PYTHON_NAME module: $1)
  34. $PYTHON -c "import $1" 2>/dev/null
  35. if test $? -eq 0;
  36. then
  37. - AC_MSG_RESULT(yes)
  38. - eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
  39. + eval AS_TR_CPP([HAVE_PYMOD_$1])=yes
  40. else
  41. - AC_MSG_RESULT(no)
  42. - eval AS_TR_CPP(HAVE_PYMOD_$1)=no
  43. + eval AS_TR_CPP([HAVE_PYMOD_$1])=no
  44. #
  45. if test -n "$2"
  46. then
  47. - AC_MSG_ERROR(failed to find required module $1)
  48. - exit 1
  49. + AC_MSG_ERROR([failed to find required module $1])
  50. fi
  51. fi
  52. + AC_MSG_RESULT([AS_TR_CPP([HAVE_PYMOD_$1])])
  53. ])
  54. diff --git a/configure.ac b/configure.ac
  55. index 5f6f604..5994d06 100644
  56. --- a/configure.ac
  57. +++ b/configure.ac
  58. @@ -534,7 +534,9 @@ if test "${enable_python_libs}" = "yes"; then
  59. PYTHON="python"
  60. fi
  61. PYTHON_NAME=`basename $PYTHON`
  62. - AX_PYTHON_MODULE("google.protobuf", "fatal")
  63. + AC_CACHE_CHECK([$PYTHON_NAME module: google.protobuf],
  64. + [ac_cv_have_pymod_google_protobuf],
  65. + [AX_PYTHON_MODULE([google.protobuf], [fatal])])
  66. fi
  67. # Maybe build the logic sniffer tools