Sometimes the Python 3 executable is called just 'python3', sometimes
it is called 'python3.4' and so on. Handle all cases transparently for
the user.
Before:
$ make install
/usr/bin/env: python3: No such file or directory
After:
$ make install
python3.4 ./tools/install-decoders -i ./decoders -o [...]
Installing 36 protocol decoders:
[...]
install-decoders:
$(MKDIR_P) $(DESTDIR)$(DECODERS_DIR)
- ${top_srcdir}/tools/install-decoders -i ${top_srcdir}/decoders \
- -o $(DESTDIR)$(DECODERS_DIR)
+ $(PYTHON3) ${top_srcdir}/tools/install-decoders \
+ -i ${top_srcdir}/decoders -o $(DESTDIR)$(DECODERS_DIR)
install-data-hook: install-decoders
AC_SUBST(CPPFLAGS_PYTHON)
AC_SUBST(LDFLAGS_PYTHON)
+# We also need to find the name of the python3 executable (for 'make install').
+# Some OSes call this python3, some call it python3.2, etc. etc.
+AC_CHECK_PROGS([PYTHON3], [python3.4 python3.3 python3.2 python3])
+if test "x$PYTHON3" == "x"; then
+ AC_MSG_ERROR([cannot find python3 executable.])
+fi
+
# Link against libm, this is required (among other things) by Python.
AC_SEARCH_LIBS([pow], [m])